@@ -195,6 +195,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
195
195
} ) ;
196
196
this . dispatchEvent ( messageEvent ) ;
197
197
this . _internalId = data . id ;
198
+ const offerOptions = { } ;
198
199
if ( typeof this . _pc . addTransceiver === 'function' ) {
199
200
// |direction| seems not working on Safari.
200
201
if ( mediaOptions . audio && stream . mediaStream . getAudioTracks ( ) . length >
@@ -230,13 +231,12 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
230
231
for ( const track of stream . mediaStream . getVideoTracks ( ) )
231
232
this . _pc . addTrack ( track , stream . mediaStream ) ;
232
233
}
234
+
235
+ offerOptions . offerToReceiveAudio = false ;
236
+ offerOptions . offerToReceiveVideo = false ;
233
237
}
234
238
235
239
let localDesc ;
236
- const offerOptions = {
237
- offerToReceiveAudio : false ,
238
- offerToReceiveVideo : false ,
239
- } ;
240
240
this . _pc . createOffer ( offerOptions ) . then ( ( desc ) => {
241
241
if ( options ) {
242
242
desc . sdp = this . _setRtpReceiverOptions ( desc . sdp , options ) ;
@@ -355,6 +355,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
355
355
this . dispatchEvent ( messageEvent ) ;
356
356
this . _internalId = data . id ;
357
357
this . _createPeerConnection ( ) ;
358
+ const offerOptions = { } ;
358
359
if ( typeof this . _pc . addTransceiver === 'function' ) {
359
360
// |direction| seems not working on Safari.
360
361
if ( mediaOptions . audio ) {
@@ -363,11 +364,11 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
363
364
if ( mediaOptions . video ) {
364
365
this . _pc . addTransceiver ( 'video' , { direction : 'recvonly' } ) ;
365
366
}
367
+ } else {
368
+ offerOptions . offerToReceiveAudio = ! ! options . audio ;
369
+ offerOptions . offerToReceiveVideo = ! ! options . video ;
366
370
}
367
- const offerOptions = {
368
- offerToReceiveAudio : ! ! options . audio ,
369
- offerToReceiveVideo : ! ! options . video ,
370
- } ;
371
+
371
372
this . _pc . createOffer ( offerOptions ) . then ( ( desc ) => {
372
373
if ( options ) {
373
374
desc . sdp = this . _setRtpReceiverOptions ( desc . sdp , options ) ;
0 commit comments