To support Screen-Sharing in the Room, you need to enable Screen-Sharing during Room Creation by setting: { "screen_share": true; }) in the JSON Payload. To receive Shared Screen, you need to subscribe to the Screen-Share Stream ID# 101 and play it on the Video Player.

Start Screen Sharing

The EnxRtc.startScreenShare() method is used to create a Screen-Sharing Stream @ 6fps to publish in the Room. Screen Sharing continues even when the Application runs in the background.

Class: EnxRtc

Method: static Future<void> startScreenShare();    

Callbacks:

  • onStartScreenShareACK– Acknowledgment to the publisher when Screen Share starts.
  • onScreenSharedStarted – Notification to everyone in the Room when Screen-Sharing starts.

Stop Screen Sharing

The EnxRtc.stopScreenShare() method is used to stop the ongoing Screen-Sharing.

Class: EnxRtc

Method: static Future<void> stopScreenShare();

Callbacks:

  • onStoppedScreenShareACK – Acknowledgment to the publisher when Screen Share stops.
  • onScreenSharedStopped – Notification to everyone in the Room when Screen-Sharing stops.
EnxRtc.onStartScreenShareACK=(Map<dynamic, dynamic> map) {
// Publisher receives acknowledgement
 };
EnxRtc.onStoppedScreenShareACK=(Map<dynamic, dynamic> map) {

// Publisher receives acknowledgement that Screen Share stopped.
 };
EnxRtc.onScreenSharedStarted=(Map<dynamic, dynamic> map) {
// A new Screen Share Stream is available, receive Information
 };
EnxRtc.onScreenSharedStopped=(Map<dynamic, dynamic> map) {
 // Screen Share has stopped. Receive Information
};

Error Codes / Exceptions:

CodeDescription
5107Repeated startScreenShare() call made while previous request is in process.
1170Screen-Sharing not supported in your subscription.