Presenting

To start sharing a screen, a file, or a video, follow the instructions below.

Share screen

Check how to share a screen with other conference participants.

Start sharing screen

Use the startScreenShare command associated with the ConferenceService to start sharing the screen:

VoxeetSDK.conference.startScreenShare()
  .then(() => {

  })
  .catch(e => {

  });

Then, the StreamAdded event is automatically sent to other participants. Check the stream.type inside it to see if the stream associated with this event is the ScreenShare type.

VoxeetSDK.conference.on('streamAdded', (participant, stream) => {
    if (stream.type == "ScreenShare") {
        /* The stream associated is a screenshare */
    }
});

if #available(iOS 11.0, *) {
    VoxeetSDK.shared.conference.startScreenShare(completion: { error in })
}

An event streamAdded will be automatically sent to other users, as in the example below. You can check its stream.type to see if the stream associated with this event is a ScreenShare.

extension YourClass: VTConferenceDelegate {
    func streamAdded(participant: VTParticipant, stream: MediaStream) {
        switch stream.type {
        case .Camera: break
        case .ScreenShare: break
        default: break
    }
}

Creating a ScreenShare session from Android requires the following lifecycle. Warning : the functionnality is only available on and after Android Lollipop

Send Request for ScreenShare Permission

VoxeetSDK.screenShare().sendRequestStartScreenShare();

An event RequestScreenSharePermissionEvent is sent from this call.

Catching the RequestScreenSharePermissionEvent

When using the uxkit, this step is managed in every activities extending VoxeetAppCompatActivity

Following the event, a call to sendUserPermissionRequest(@NonNull Activity activity) must be done.

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

Catching the permission result from the system

When using the uxkit, this step is managed in every activities extending VoxeetAppCompatActivity

The main activity of the application will when be callbacked by the system with the permission result from the User. This must be forwarded to the ScreenShareService

    @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);
        }
    }

Consuming the ScreenShare Bundle

When using the uxkit, this step is managed in every activities extending VoxeetAppCompatActivity

After the User consented for the screen sharing session, the final obtained bundle must be consumed when the activity has finally be done resuming. This can be achieved using the consumeRightsToScreenShare.

    @Override
    protected void onResume() {
        super.onResume();

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

Final negociation received

When the SDK has done managing the session, an event will be fired with the managed stream in a StreamAddedEvent

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(@NonNull StreamAddedEvent event) {
        /* Event received for any MediaStream but in our context, a test for type = MediaStreamType.ScreenShare will be useful */
    }

Stop sharing screen

Use the stopScreenShare command associated with the ConferenceService to stop sharing the screen:

VoxeetSDK.conference.stopScreenShare()

Then, the streamRemoved event is automatically sent to other participants. Check the stream.type inside it to see if the stream associated with this event is a ScreenShare type.

VoxeetSDK.conference.on('streamRemoved', (participant, stream) => {
    if (stream.type == "ScreenShare") {
        /* The stream removed is a screenshare */
    }
});

if #available(iOS 11.0, *) {
    VoxeetSDK.shared.conference.stopScreenShare(completion: { error in })
}

An event streamRemoved will be automatically sent to other users, as in the example below. You can check its stream.type to see if the stream associated with this event is a ScreenShare.

extension YourClass: VTConferenceDelegate {
    func streamRemoved(participant: VTParticipant, stream: MediaStream) {
        switch stream.type {
        case .Camera: break
        case .ScreenShare: break
        default: break
    }
}

Write the stopScreenShare command associated in the ScreenShareSerice as in the following example.

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

An event StreamRemovedEvent will be automatically sent to other users, as in the example below. You can check its mediaStream.type to see if the stream associated with this event is a ScreenShare.

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

File Presentation

Check how to share a file with other conference participants.

Convert file

This option converts a file into multiple pages, as images, and uses them during the conference.

Use the convertFile command to upload and convert the file before the presentation:

voxeet.convertFile(...)

Then, the converted event containing FilePresentation object is emitted:

VoxeetSDK.filePresentation.on('conversionProgress', (e: FileConversionProgress) => {
  /* Follow the file conversion progress */
});

VoxeetSDK.filePresentation.on('converted', (e: FilePresentation) => {
  /* Trigger when the file is converted */
});

VoxeetSDK.shared.filePresentation.convert(path: filePath, progress: { progress in
}, success: { response in
}, fail: { error in
})

Promise<FilePresentation> promise = VoxeetSDK.filePresentation().convertFile(File file);
  • the promise will resolve when the conversion will be done
  • an event will also be fired containing the exact same object as the one the promise will resolve
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull FilePresentationConverted event) {
  /* Trigger when the file is converted */
}

Start file presentation

Use the start method with the previously received FilePresentation object to start presenting the file:

VoxeetSDK.filePresentation.start(file: FilePresentation)

VoxeetSDK.shared.filePresentation.start(file: FilePresentation, completion: { error in  })

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

Update file presentation

The application coordinates the page flip between local and presented files, it needs to call the update method to inform the service to send updated page number to the participants.

Use the update method from the FilePresentationService to update a file. Include in it a position (page) of the file that you want to share (for example 3, in case of page 3 of the file).

VoxeetSDK.filePresentation.update(file: FilePresentation, position: number)

Then, the updated event is sent to all participants. The getImage method allows getting the URL of the image that corresponds to the current file position.

VoxeetSDK.filePresentation.on('updated', (e: FilePresentation) => {
  /* When the position in the file changed, this event will be triggered */
  VoxeetSDK.filePresentation.getImage(e.fileId, e.position).then(image => {
    /* You can now show to users, the image at the current position (image contains an url) */
  });
});

VoxeetSDK.shared.filePresentation.update(file: FilePresentation, page: Int, completion: { error in })

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

The updated event will be sent to all attendees, as in the following example. The getImage method allows getting the image’s URL corresponding to the current file position.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull FilePresentationUpdated event) {
  /* When the position in the file changed, this event will be triggered */
  String imageUrl = VoxeetSDK.filePresentation().getImage(event.fileId, event.position);
}

Stop file presentation

Use the stop method related to the FilePresentationService to stop presenting the file:

VoxeetSDK.filePresentation.stop(file: FilePresentation)

Then, the stop event is sent to all participants.

VoxeetSDK.filePresentation.on('stop', (e: FilePresentation) => {
  /* File presentation has been stopped */
});

VoxeetSDK.shared.filePresentation.stop(completion: { error in })

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

All attendees will receive an event as in the following example.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull FilePresentationStopped event) {
  /* File presentation has been stopped */
}

Video Presentation

Check how to share a video with other conference participants.

Start a video presentation

Use the start command including the URL of the video to start sharing the video file:

VoxeetSDK.videoPresentation.start(url: string)

Then, the started event is sent to all participants.

VoxeetSDK.filePresentation.on('started', (e: FilePresentation) => {
  /* A video presentation has started, contains url to the video */
});

VoxeetSDK.shared.videoPresentation.start(url: URL, completion: { error in })

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().start(@NonNull String url);

Other participants will receive an event informing that the video presentation was started, as in the example below.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationStarted event) {
  /* A video presentation has started, contains url to the video */
}

Pause video presentation

Use the pause command, to pause the video presentation:

VoxeetSDK.videoPresentation.pause(timestamp: number)

Then, the pause event is sent to all participants.

VoxeetSDK.videoPresentation.on("pause", (e: VideoPresentation) => {
  /* Video presentation has been pause */
});

VoxeetSDK.shared.videoPresentation.pause(completion: { error in })

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().pause(long timestamp);

Other participants will receive an event informing that the presentation was paused, as in the example below.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationPaused event) {
  /* Video presentation has been pause */
}

Play video presentation

Use the play command to play or resume the video:

VoxeetSDK.videoPresentation.play()

Then, the play event is sent to all participants.

VoxeetSDK.videoPresentation.on("play", (e: VideoPresentation) => {
  /* Video presentation has been resume */
});

VoxeetSDK.shared.videoPresentation.play(completion: { error in })

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().play();

Other participants will receive an event informing that the video is played, as in the example below.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationPlay event) {
  /* Video presentation has been resume */
}

Seek position

While sharing the video with other conference participants, the application coordinates the timestamp in local and presented video. Use the seek method related to the VideoPresentationService to inform other participants about the current video position.

VoxeetSDK.videoPresentation.seek(timestamp: number)

Then, the seek event is sent to all participants.

VoxeetSDK.videoPresentation.on("seek", (e: VideoPresentation) => {
  /* Contains the timestamp to seek */
});

VoxeetSDK.shared.videoPresentation.seek(time: Int, completion: { error in })

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().seek(long timestamp);

The following event will be sent to all conference participants to inform them about the current position.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationSeek event) {
  /* Contains the timestamp to seek */
}

Stop video presentation

Use the stop method from FilePresentationService to stop a video presentation.

VoxeetSDK.videoPresentation.stop()

Then, the stopped event is sent to all participants.

VoxeetSDK.videoPresentation.on('stopped', (e: FilePresentation) => {
  /* Video presentation has been stopped */
});

VoxeetSDK.shared.videoPresentation.stop(completion: { error in })

Promise<VideoPresentation> promise = VoxeetSDK.videoPresentation().stop();

The following event will be sent to all conference participants to inform them that the video presentation was stopped.

@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(@NonNull VideoPresentationStopped event) {
  /* Video presentation has been stopped */
}