Get access to StreamsHandler.js
// first parameter is your MediaStream object // second parameter is: should I sync mute/unmute/stop action across all users // third parameter is your "connection" object connection.StreamsHandler.setHandlers(screenStream, true, connection);
This object helps you force syncing of screen-stop action across all connected users.
RTCMultiConnection, by default, always forces sync-action. i.e. it tells all connected users that your stream is muted or unmute or stopped.
connection.StreamsHandler.onSyncNeeded = function(streamid, action, type) { connection.peers.getAllParticipants().forEach(function(participant) { mPeer.onNegotiationNeeded({ streamid: streamid, action: action, streamSyncNeeded: true, type: type || 'both' }, participant); }); };