MenuMenu

RTCMultiConnection.replaceTrack

Change between camera and screen or two cameras seamlessly across all users

How to use

var screenTrack = screenStream.getVideoTracks()[0];

// replace across all users
connection.replaceTrack(screenTrack);

// replace for a specific user only
connection.replaceTrack(screenTrack, 'specific-user-id');

This method is strongly recommended over renegotiate.

There is a relevant API: resetTrack which resets back to original track.