Skip to content

Commit

Permalink
fix bug failed to adjust volume on viewer side
Browse files Browse the repository at this point in the history
  • Loading branch information
qnkhuat committed Jul 20, 2021
1 parent abcca67 commit ef0c013
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/components/AudioRTC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class AudioRTC extends React.Component<Props, State> {
super(props);

this.state = {
lastVolume: props.volume || 1,
volume: props.volume || 1,
lastVolume: props.volume || 0,
volume: props.volume || 0,
isPlayed: false,
trackIDs: [],
openModal: false,
Expand All @@ -49,7 +49,7 @@ class AudioRTC extends React.Component<Props, State> {
if (el.paused) {
el.play().
catch((e) => {
this.setState({isPlayed: false, volume: 0});
this.setState({isPlayed: false, volume: 0, openModal: true});
});
}
el.volume = volume as number;
Expand Down Expand Up @@ -208,7 +208,7 @@ class AudioRTC extends React.Component<Props, State> {
{this.state.isPlayed && this.state.volume > 0.4 && <VolumeUp fontSize="small" />}
</IconButton>
<Slider className="py-0 mx-4 hidden group-hover:block w-28" aria-label="Volume" step={0.1} min={0} max={1}
value={this.state.volume} onChange={this.handleChangeVolume} />
value={this.state.volume} onChange={this.handleChangeVolume.bind(this)} />
</div>
<Modal
open={this.state.openModal}
Expand Down

0 comments on commit ef0c013

Please # to comment.