Skip to content

Commit 5bbdee0

Browse files
author
kubraturan
committed
audioMuted and audioSource added to MeetingItem
1 parent 9ec4059 commit 5bbdee0

3 files changed

Lines changed: 8 additions & 30 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,8 @@ import { MeetingItem } from 'react-chat-elements'
656656
| onCloseClick | none | function | MeetingItem on close click |
657657
| avatars | none | date | MeetingItem avatars |
658658
| avatarLimit | 5 | date | MeetingItem avatars limit |
659-
| meetSoundPlay| null | object | MeetingItem to add sound |
659+
| audioMuted| true | boolean | MeetingItem audio muted |
660+
| audioSource| null | string | MeetingItem audio source |
660661

661662

662663
## MeetingList Component

src/MeetingItem/MeetingItem.js

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,6 @@ import classNames from 'classnames';
1515

1616
export class MeetingItem extends Component {
1717

18-
componentDidMount() {
19-
if (this.props.meetSoundPlay && this.props.meetSoundPlay.play)
20-
this.playSound();
21-
}
22-
23-
componentWillReceiveProps(nextProps) {
24-
if (nextProps.meetSoundPlay) {
25-
if (nextProps.meetSoundPlay.play)
26-
this.playSound();
27-
else
28-
this.closeSound();
29-
}
30-
}
31-
32-
playSound() {
33-
var meetSound = this.refs['meetSound'];
34-
meetSound.autoplay = true;
35-
meetSound.loop = true;
36-
};
37-
38-
closeSound() {
39-
var meetSound = this.refs['meetSound'];
40-
meetSound.pause();
41-
meetSound.currentTime = 0;
42-
}
43-
4418
render() {
4519
const statusColorType = this.props.statusColorType;
4620
const AVATAR_LIMIT = this.props.avatarLimit;
@@ -59,9 +33,11 @@ export class MeetingItem extends Component {
5933
onContextMenu={this.props.onContextMenu}>
6034

6135
<audio
36+
autoPlay
37+
loop
6238
ref="meetSound"
63-
src={this.props.meetSoundPlay && this.props.meetSoundPlay.src}
64-
autoPlay/>
39+
muted={this.props.audioMuted}
40+
src={this.props.audioSource}/>
6541

6642
<div className="rce-mtitem">
6743
<div className="rce-mtitem-top">
@@ -153,7 +129,8 @@ MeetingItem.defaultProps = {
153129
lazyLoadingImage: undefined,
154130
avatarLimit: 5,
155131
avatars: [],
156-
meetSoundPlay: null,
132+
audioMuted: true,
133+
audioSource: null,
157134
onAvatarError: () => void(0),
158135
onMeetingClick: () => void(0),
159136
onShareClick: () => void(0),

src/assets/conference_sound.mp3

26.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)