openvidu-browser: Fixed bug when addTransceiver not available (#634)

After generateOffer() refactoring, the deprecated legacy method wasn't adding the meadstream tracks on peerConnection object as it used to do.
pull/635/head
Carlos Santos 2021-06-22 13:31:25 +02:00 committed by GitHub
parent 3f0756984a
commit 66b1ce790d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -171,6 +171,13 @@ export class WebRtcPeer {
// Transceivers, and instead depend on the deprecated
// "offerToReceiveAudio" and "offerToReceiveVideo".
if (!!this.configuration.mediaStream) {
for (const track of this.configuration.mediaStream.getTracks()) {
// @ts-ignore - Compiler is too clever and thinks this branch will never execute.
this.pc.addTrack(track, this.configuration.mediaStream);
}
}
const hasAudio = this.configuration.mediaConstraints.audio;
const hasVideo = this.configuration.mediaConstraints.video;