Current Workflow

 As of SkylinkJS 0.6.3, the current workflow to handle restarts in a MCU environment for shareScreen(), stopScreen(), sendStream(), refreshConnection() will involve peers leaving and re-joining the room.


Steps in P2P (normal) environment:

  1. [Either: shareScreen() / stopScreen() / sendStream() / refreshConnection() ] method is invoked.
  2. (If there is a new stream) "incomingStream" event is triggered for self.
  3. "peerRestart" event is triggered for all connected Peers.


Steps in MCU environment:

  1. [Either: shareScreen() / stopScreen() / sendStream() / refreshConnection() ] method is invoked.
  2. "peerRestart" event is triggered for all connected Peers.
  3.  "serverPeerRestart" event is triggered for MCU Peer.
  4. SDK invokes leaveRoom().
  5. "peerLeft" event is triggered for self and all connected Peers.
  6. "serverPeerLeft" event is triggered for MCU Peer.
  7. "streamEnded" events is triggered for all connected Peers that has stream.
  8. SDK invokes joinRoom() to the previously connected Room name.
  9. "peerJoined" event is triggered for self.
  10. (If user has stream) "incomingStream" event is triggered for self.
  11. "serverPeerJoined" event is triggered for MCU Peer.
  12. "peerJoined" event is triggered for Peers in the Room.
  13. "incomingStream" event is triggered for Peers that has stream.


Why is the Workflow different from the P2P (normal) scenario?

SkylinkJS introduced the restart functionality in SkylinkJS 0.5.9 and the screensharing functionality in version 0.6.0 that uses the restart functionality. The MCU, however, does not support restarting of connections, and by extension did not support screensharing. A workaround was made for SkylinkJS 0.6.3 where the MCU could support screensharing by leaving and re-joining the room.