Skip to content

Commit

Permalink
openvidu-browser: Fixed bug with screensharing
Browse files Browse the repository at this point in the history
When a screen publisher was initialized with audio but the user disable the publish audio after it, in the default browser popup, the subscriber was not able to receive the video and audio. There was an inconsistent with transceivers in webrtpeer
  • Loading branch information
CSantosM committed Oct 26, 2023
1 parent 809ba26 commit 875c853
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions openvidu-browser/src/OpenVidu/Publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ export class Publisher extends StreamManager {
};

if (this.stream.isSendScreen()) {

if(this.stream.isSendAudio() && mediaStream.getAudioTracks().length === 0){
// If sending audio is enabled and there are no audio tracks in the mediaStream, disable audio for screen sharing.
this.stream.audioActive = false;
this.stream.hasAudio = false;
this.stream.outboundStreamOpts.publisherProperties.publishAudio = false;
this.stream.outboundStreamOpts.publisherProperties.audioSource = false;
}

// Set interval to listen for screen resize events
this.screenShareResizeInterval = setInterval(() => {
const settings: MediaTrackSettings = mediaStream.getVideoTracks()[0].getSettings();
Expand Down

0 comments on commit 875c853

Please sign in to comment.