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

1. The presenter calls startScreenShare method to start sharing the screen. The method includes the broadcast parameter that specifies whether the application should share the screen only inside the application (false) or should share the whole screen, even when the application is enabled in the background (true). For more information about setting up screen-share outside the application, see the ScreenShare with iOS article.

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

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

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

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

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

4. 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.

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

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.

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

2. The presenter receives converted event when the file conversion is finished.

func converted(fileConverted: VTFileConverted) {}

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

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

4. The presenter and the viewers receive the started event that informs that the file presentation starts. Upon receiving the started 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.

func started(filePresentation: VTFilePresentation) {
    if let url = VoxeetSDK.shared.filePresentation.image(page: filePresentation.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.

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

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

func updated(filePresentation: VTFilePresentation) {
    if let url = VoxeetSDK.shared.filePresentation.image(page: filePresentation.position) {

    }
}

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

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

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

func stopped(filePresentation: VTFilePresentation) {}