From ef0c01363955552828bacdb5a5143d72452169c3 Mon Sep 17 00:00:00 2001 From: Earther Date: Tue, 20 Jul 2021 17:41:34 +0700 Subject: [PATCH] fix bug failed to adjust volume on viewer side --- client/src/components/AudioRTC.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/components/AudioRTC.tsx b/client/src/components/AudioRTC.tsx index c25e202..eabdeca 100644 --- a/client/src/components/AudioRTC.tsx +++ b/client/src/components/AudioRTC.tsx @@ -34,8 +34,8 @@ class AudioRTC extends React.Component { 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, @@ -49,7 +49,7 @@ class AudioRTC extends React.Component { 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; @@ -208,7 +208,7 @@ class AudioRTC extends React.Component { {this.state.isPlayed && this.state.volume > 0.4 && } + value={this.state.volume} onChange={this.handleChangeVolume.bind(this)} />