Skip to content

Commit

Permalink
Merge pull request #797 from OpenVidu/ov_browser_fix
Browse files Browse the repository at this point in the history
Audio is not working properly when camera is muted
  • Loading branch information
pabloFuente committed Apr 3, 2023
2 parents 7060a0b + ec807d3 commit 83e9ab7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions openvidu-browser/src/OpenVidu/Session.ts
Expand Up @@ -992,6 +992,10 @@ export class Session extends EventDispatcher {
oldValue = stream.videoActive;
event.newValue = event.newValue === 'true';
stream.videoActive = event.newValue;
const videoTrack = stream.getMediaStream().getVideoTracks()[0];
if(!videoTrack.enabled && stream.videoActive){
videoTrack.enabled = true;
}
break;
case 'videoTrack':
event.newValue = JSON.parse(event.newValue);
Expand Down
2 changes: 1 addition & 1 deletion openvidu-browser/src/OpenVidu/Stream.ts
Expand Up @@ -1481,7 +1481,7 @@ export class Stream {
this.mediaStream.getAudioTracks()[0].enabled = enabled;
}
if (!!this.mediaStream.getVideoTracks()[0]) {
const enabled = reconnect ? this.videoActive : !!(this.streamManager as Subscriber).properties.subscribeToVideo;
const enabled = reconnect ? this.videoActive : !!this.videoActive && !!(this.streamManager as Subscriber).properties.subscribeToVideo;
this.mediaStream.getVideoTracks()[0].enabled = enabled;
}
}
Expand Down

0 comments on commit 83e9ab7

Please sign in to comment.