Presenting

Dolby.io Communications APIs offer three options that allow the conference participants to enhance collaboration during a conference by sharing media with the rest of the participants. The participants can share their screens, files, or videos. This guide informs how to use the mentioned presenting options.

Share a screen

The screen-share option allows a presenter to share the contents of the presenter's screen with other conference participants. The following procedure presents a workflow that explains how to use the screen-share option.

The Android screen-share workflow requires obtaining the proper permission before sharing the screen. The following steps present the simplest workflow; if you wish to find more information about the screen-share capabilities on Android, see the ScreenShareService documentation.

1. The presenter calls the sendRequestStartScreenShare method to request the screen-share permission.

VoxeetSDK.screenShare().sendRequestStartScreenShare();

2. The presenter receives the RequestScreenSharePermissionEvent event and calls the sendUserPermissionRequest method.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull RequestScreenSharePermissionEvent event) {
    VoxeetSDK.screenShare().sendUserPermissionRequest(currentActivity);
    //In the context of the current activity: currentActivity = this
}

3. The system forwards the requested permissions to the ScreenShareService and verifies the received bundle using the consumeRightsToScreenShare.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    boolean managed = false;

    if (null != VoxeetSDK.screenShare()) {
        managed = VoxeetSDK.screenShare().onActivityResult(requestCode, resultCode, data);
    }

    if (!managed) {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
@Override
protected void onResume() {
    super.onResume();

    if (null != VoxeetSDK.screenShare()) {
        VoxeetSDK.screenShare().consumeRightsToScreenShare();
    }
}

4. The presenter calls the startScreenShare method to start sharing the screen. The method uses the intent parameter that the presenter obtains together with the permission to share the screen.

Promise<Boolean> promise = VoxeetSDK.screenShare().startScreenShare(Intent intent);

5. The rest of the conference participants receive the StreamAddedEvent event that includes the "ScreenShare" stream.type. The event informs that the screen-share stream was successfully added.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull StreamAddedEvent event) {
    MediaStream mediaStream = event.mediaStream;
    MediaStreamType type = mediaStream.type;
}

6. The presenter calls the stopScreenShare method to stop sharing the screen.

Promise<Boolean> promise = VoxeetSDK.screenShare().stopScreenShare();

7. The rest of the conference participants receive the streamRemoved event that includes the "ScreenShare" stream.type. The event informs that the screen-share stream was successfully removed.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull StreamRemovedEvent event) {
    MediaStream mediaStream = event.mediaStream;
    MediaStreamType type = mediaStream.type;
}

Share a file

The following procedure describes the workflow that allows a presenter to share a file during a conference. The Dolby.io Communications APIs service converts the user-provided file into multiple pages, as images, accessible through the image method.

1. The presenter calls the convert method to upload and convert a file.

Promise<FilePresentation> promise = VoxeetSDK.filePresentation().convert(File file);

2. After the conversion, the FilePresentationConverted event is emitted.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull FilePresentationConverted event) {
}

3. The presenter calls the start method to start presenting the file.

Promise<FilePresentation> promise = VoxeetSDK.filePresentation().start(@NonNull FilePresentationConverted filePresentation);

4. The presenter and the viewers receive the FilePresentationStarted event that informs that the file presentation starts. Upon receiving the FilePresentationStarted event, call the image method to get the converted file images URLs and display the proper page of the file by retrieving the individual images.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull FilePresentationStarted event) {
  String imageUrl = VoxeetSDK.filePresentation().image(event.fileId, event.position);
}

5. The application is responsible for coordinating the page flip between the local and the presented files. The presenter calls the update method to inform the service to send the updated page number to the participants.

Promise<FilePresentation> promise = VoxeetSDK.filePresentation().update(@NonNull String fileId, int position);

6. The presenter and viewers receive the FilePresentationUpdated event with the current page number. Receiving the FilePresentationUpdated event should trigger calling the image method to display the proper page of the file by retrieving the individual images.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull FilePresentationUpdated event) {
  String imageUrl = VoxeetSDK.filePresentation().image(event.fileId, event.position);
}

7. The presenter calls the stop method to end the file presentation.

Promise<FilePresentation> promise = VoxeetSDK.filePresentation().stop(@NonNull String fileId);

8. The presenter and the viewers receive the FilePresentationStopped event to inform about the end of the file presentation.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull FilePresentationStopped event) {
}

Share a video

The following procedure describes the workflow that allows a presenter to share a video during a conference.

1. The presenter calls the start method to start the video presentation. This method automatically starts playing the shared video file. All participants receive the VideoPresentationStarted event.

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().start(@NonNull String url);
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationStarted event) {
}

2. The presenter can call the pause method to pause the shared video. All participants receive the VideoPresentationPaused event.

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().pause(long timestamp);
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationPaused event) {
}

3. The presenter can call the play method to resume the paused video. All participants receive the VideoPresentationPlay event.

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().play();
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationPlayed event) {
}

4. The presenter can call the seek method to navigate to a specific section of the shared video. All participants receive the VideoPresentationSeek event and watch the video from the specified timestamp.

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().seek(long timestamp);
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationSought event) {
}

5. The presenter calls the stop method to stop the video presentation. All participants receive the VideoPresentationStopped event.

Promise < VideoPresentation > promise = VoxeetSDK.videoPresentation().stop()
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationStopped event) {
}