@@ -220,9 +220,24 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
220
220
this . _pc . addTransceiver ( stream . mediaStream . getVideoTracks ( ) [ 0 ] ,
221
221
transceiverInit ) ;
222
222
}
223
+ } else {
224
+ if ( mediaOptions . audio && stream . mediaStream . getAudioTracks ( ) . length > 0 ) {
225
+ for ( const track of stream . mediaStream . getAudioTracks ( ) )
226
+ this . _pc . addTrack ( track , stream . mediaStream ) ;
227
+ }
228
+
229
+ if ( mediaOptions . video && stream . mediaStream . getVideoTracks ( ) . length > 0 ) {
230
+ for ( const track of stream . mediaStream . getVideoTracks ( ) )
231
+ this . _pc . addTrack ( track , stream . mediaStream ) ;
232
+ }
223
233
}
234
+
224
235
let localDesc ;
225
- this . _pc . createOffer ( ) . then ( ( desc ) => {
236
+ const offerOptions = {
237
+ offerToReceiveAudio : false ,
238
+ offerToReceiveVideo : false ,
239
+ } ;
240
+ this . _pc . createOffer ( offerOptions ) . then ( ( desc ) => {
226
241
if ( options ) {
227
242
desc . sdp = this . _setRtpReceiverOptions ( desc . sdp , options ) ;
228
243
}
@@ -328,6 +343,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
328
343
} else {
329
344
mediaOptions . video = false ;
330
345
}
346
+
331
347
this . _subscribedStream = stream ;
332
348
this . _signaling . sendSignalingMessage ( 'subscribe' , {
333
349
media : mediaOptions ,
@@ -348,7 +364,11 @@ export class ConferencePeerConnectionChannel extends EventDispatcher {
348
364
this . _pc . addTransceiver ( 'video' , { direction : 'recvonly' } ) ;
349
365
}
350
366
}
351
- this . _pc . createOffer ( ) . then ( ( desc ) => {
367
+ const offerOptions = {
368
+ offerToReceiveAudio : ! ! options . audio ,
369
+ offerToReceiveVideo : ! ! options . video ,
370
+ } ;
371
+ this . _pc . createOffer ( offerOptions ) . then ( ( desc ) => {
352
372
if ( options ) {
353
373
desc . sdp = this . _setRtpReceiverOptions ( desc . sdp , options ) ;
354
374
}
0 commit comments