File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ window.RTCPeerConnection = function (conf, options) {
129
129
} ,
130
130
options ,
131
131
)
132
+ debug ( `created` , { conf, options, pc } )
132
133
133
134
PeerConnections . set ( id , pc )
134
135
@@ -296,6 +297,24 @@ window.RTCPeerConnection = function (conf, options) {
296
297
}
297
298
}
298
299
300
+ const addTrackNative = pc . addTrack . bind ( pc )
301
+ pc . addTrack = ( ...args ) => {
302
+ debug ( `addTrack` , args )
303
+ const sender = addTrackNative ( ...args )
304
+ for ( const transceiver of pc . getTransceivers ( ) ) {
305
+ if ( [ 'sendonly' , 'sendrecv' ] . includes ( transceiver . direction ) ) {
306
+ if ( encodedInsertableStreams && timestampInsertableStreams ) {
307
+ handleTransceiverForInsertableStreams ( id , transceiver )
308
+ }
309
+ handleTransceiverForPlayoutDelayHint ( id , transceiver , 'addTrack' )
310
+ handleTransceiverForJitterBufferTarget ( id , transceiver , 'addTrack' )
311
+
312
+ checkSaveStream ( transceiver )
313
+ }
314
+ }
315
+ return sender
316
+ }
317
+
299
318
pc . addEventListener ( 'track' , async event => {
300
319
const { receiver, transceiver } = event
301
320
if ( receiver ?. track ) {
You can’t perform that action at this time.
0 commit comments