File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,15 @@ export class Subscriber {
218
218
this . logger ( 'error' , `Unknown track type: ${ rawTrackType } ` ) ;
219
219
return ;
220
220
}
221
+
221
222
const previousStream = participantToUpdate [ streamKindProp ] ;
223
+
224
+ // replace the previous stream with the new one, prevents flickering
225
+ this . state . updateParticipant ( participantToUpdate . sessionId , {
226
+ [ streamKindProp ] : primaryStream ,
227
+ } ) ;
228
+
229
+ // now, dispose the previous stream
222
230
if ( previousStream ) {
223
231
this . logger (
224
232
'info' ,
@@ -229,9 +237,6 @@ export class Subscriber {
229
237
previousStream . removeTrack ( t ) ;
230
238
} ) ;
231
239
}
232
- this . state . updateParticipant ( participantToUpdate . sessionId , {
233
- [ streamKindProp ] : primaryStream ,
234
- } ) ;
235
240
} ;
236
241
237
242
private onIceCandidate = ( e : RTCPeerConnectionIceEvent ) => {
You can’t perform that action at this time.
0 commit comments