@@ -195,6 +195,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
195195 } ) ;
196196 this . dispatchEvent ( messageEvent ) ;
197197 this . _internalId = data . id ;
198+ const offerOptions = { } ;
198199 if ( typeof this . _pc . addTransceiver === 'function' ) {
199200 // |direction| seems not working on Safari.
200201 if ( mediaOptions . audio && stream . mediaStream . getAudioTracks ( ) . length >
@@ -230,13 +231,12 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
230231 for ( const track of stream . mediaStream . getVideoTracks ( ) )
231232 this . _pc . addTrack ( track , stream . mediaStream ) ;
232233 }
234+
235+ offerOptions . offerToReceiveAudio = false ;
236+ offerOptions . offerToReceiveVideo = false ;
233237 }
234238
235239 let localDesc ;
236- const offerOptions = {
237- offerToReceiveAudio : false ,
238- offerToReceiveVideo : false ,
239- } ;
240240 this . _pc . createOffer ( offerOptions ) . then ( ( desc ) => {
241241 if ( options ) {
242242 desc . sdp = this . _setRtpReceiverOptions ( desc . sdp , options ) ;
@@ -355,6 +355,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
355355 this . dispatchEvent ( messageEvent ) ;
356356 this . _internalId = data . id ;
357357 this . _createPeerConnection ( ) ;
358+ const offerOptions = { } ;
358359 if ( typeof this . _pc . addTransceiver === 'function' ) {
359360 // |direction| seems not working on Safari.
360361 if ( mediaOptions . audio ) {
@@ -363,11 +364,11 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
363364 if ( mediaOptions . video ) {
364365 this . _pc . addTransceiver ( 'video' , { direction : 'recvonly' } ) ;
365366 }
367+ } else {
368+ offerOptions . offerToReceiveAudio = ! ! options . audio ;
369+ offerOptions . offerToReceiveVideo = ! ! options . video ;
366370 }
367- const offerOptions = {
368- offerToReceiveAudio : ! ! options . audio ,
369- offerToReceiveVideo : ! ! options . video ,
370- } ;
371+
371372 this . _pc . createOffer ( offerOptions ) . then ( ( desc ) => {
372373 if ( options ) {
373374 desc . sdp = this . _setRtpReceiverOptions ( desc . sdp , options ) ;
0 commit comments