diff --git a/src/views/tinode-web.jsx b/src/views/tinode-web.jsx index 5a2938d7..93498d4e 100644 --- a/src/views/tinode-web.jsx +++ b/src/views/tinode-web.jsx @@ -1737,7 +1737,7 @@ class TinodeWeb extends React.Component { switch (callState) { case CALL_STATE_OUTGOING_INITATED: const head = { webrtc: CALL_HEAD_STARTED, aonly: !!audioOnly }; - this.handleSendMessage(Drafty.videoCall(), undefined, undefined, head) + this.handleSendMessage(Drafty.videoCall(audioOnly), undefined, undefined, head) .then(ctrl => { if (ctrl.code < 200 || ctrl.code >= 300 || !ctrl.params || !ctrl.params.seq) { this.handleCallClose(); diff --git a/src/widgets/call-panel.jsx b/src/widgets/call-panel.jsx index bf697aea..72d8ed3a 100644 --- a/src/widgets/call-panel.jsx +++ b/src/widgets/call-panel.jsx @@ -34,11 +34,10 @@ class CallPanel extends React.PureComponent { previousOnInfo: undefined, waitingForPeer: false, // If true, the client has received a remote SDP from the peer and has sent a local SDP to the peer. - callInitialSetupComplete: false + callInitialSetupComplete: false, + audioOnly: props.callAudioOnly, }; - console.log("CallPanel", props.callAudioOnly); - this.localStreamConstraints = { audio: true, video: !props.callAudioOnly @@ -148,7 +147,7 @@ class CallPanel extends React.PureComponent { if (this.props.callState == CALL_STATE_IN_PROGRESS) { // We apparently just accepted the call. - this.props.onInvite(this.props.topic, this.props.seq, this.props.callState, this.props.callAudioOnly); + this.props.onInvite(this.props.topic, this.props.seq, CALL_STATE_IN_PROGRESS, this.props.callAudioOnly); return; } @@ -404,6 +403,7 @@ class CallPanel extends React.PureComponent { handleToggleCameraClick() { this.toggleMedia('video'); + this.setState({audioOnly: !this.state.audioOnly}); } handleToggleMicClick() { @@ -412,10 +412,9 @@ class CallPanel extends React.PureComponent { render() { const remoteActive = this.remoteRef.current && this.remoteRef.current.srcObject; - const noVideo = this.props.callAudioOnly; const audioTracks = this.state.localStream && this.state.localStream.getAudioTracks(); - const videoTracks = !noVideo && this.state.localStream && this.state.localStream.getVideoTracks(); - const enabled = !!(audioTracks && audioTracks[0]); + const videoTracks = !this.state.audioOnly && this.state.localStream && this.state.localStream.getVideoTracks(); + const disabled = !(audioTracks && audioTracks[0]); const audioIcon = audioTracks && audioTracks[0] && audioTracks[0].enabled ? 'mic' : 'mic_off'; const videoIcon = videoTracks && videoTracks[0] && videoTracks[0].enabled ? 'videocam' : 'videocam_off'; const peerTitle = clipStr(this.props.title, MAX_PEER_TITLE_LENGTH); @@ -425,16 +424,16 @@ class CallPanel extends React.PureComponent { <>
-
+
-
+