FilePresentationService

The FilePresentationService allows presenting files during a conference. The Dolby.io Communications APIs service converts the user-provided file into multiple pages, as images, accessible through the image method.

The file presentation workflow:

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

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

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

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.

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.

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.

7. The presenter may call the thumbnail method to obtain thumbnail images of the file and implement a carousel control for the presenting user to flip pages locally.

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

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

The following diagram presents the easiest workflow for presenting files during a conference.


4061

The file presentation diagram

The current accessor allows the participants to receive information about the current state of the file presentation.

The service is available only to participants who joined a conference using the join method; it is not available for listeners.


Events

converted

converted(fileConverted: VTFileConverted)

Emitted when the file is converted.

Parameters:

NameTypeDescription
fileConvertedVTFileConvertedThe object containing properties specific to the event.

started

started(filePresentation: VTFilePresentation)

Emitted when the presenter starts the file presentation.

Parameters:

NameTypeDescription
filePresentationVTFilePresentationThe object containing properties specific to the event.

updated

updated(filePresentation: VTFilePresentation)

Emitted when the presenter changes the displayed page of the shared file. The event includes information about the current page number.

Parameters:

NameTypeDescription
filePresentationVTFilePresentationThe object containing properties specific to the event.

stopped

stopped(filePresentation: VTFilePresentation)

Emitted when the presenter ends the file presentation.

Parameters:

NameTypeDescription
filePresentationVTFilePresentationThe object containing properties specific to the event.

Accessors

current

current: VTFilePresentation

Returns information about the current state of the file presentation. Use this accessor if you wish to receive information that is available in the VTFilePresentation object, such as the file ID, the number of images in the presentation, information about the file owner, or the current position in the presentation.

Returns: VTFilePresentation


delegate

delegate: VTFilePresentationDelegate

Delegate, a means of communication between objects in the file presentation service.

Returns: VTFilePresentationDelegate

Methods

convert

convert(path: URL, progress: (( progress: Double) -> Void)?, success: (( json: [String: Any]?) -> Void)?, fail: ((_ error: NSError) -> Void)?)

Converts the user-provided file into multiple pages, as images, that can be shared during the file presentation. The file is uploaded as FormData.

Supported file formats are:

  • doc/docx (Microsoft Word)
  • ppt/pptx
  • pdf

After conversion, the files are broken into individual images with maximum resolution capped at 2560px x 1600px.

When the file is converted and ready for the presentation, the application receives the converted event.

Only the converted files can be shared during conferences.

Parameters:

NameTypeDefaultDescription
pathURL-The to the file that the presenter wants to share during the conference.
progress((_ progress: Double) -> Void)?nilThe conversion progress.
success((_ json: [String: Any]?) -> Void)?-The successful result of the operation.
fail((_ error: NSError) -> Void)?-The failed operation.

start

start(file: VTConvertedFile, completion: ((_ error: NSError?) -> Void)?)

Starts a file presentation. The Dolby.io Communications APIs allow presenting only the converted files.

Parameters:

NameTypeDefaultDescription
fileVTConvertedFile-The converted file that the presenter wants to share during the conference.
completion((_ error: NSError?) -> Void)?nilThe block to execute when the query completes.

update

update(page: Int, completion: ((_ error: NSError?) -> Void)?)

Informs the service to send the updated page number to the conference participants.

Parameters:

NameTypeDefaultDescription
pageInt-The page number that corresponds to the page that should be presented.
completion((_ error: NSError?) -> Void)?nilThe block to execute when the query completes.

stop

stop( completion: ((_ error: NSError?) -> Void)?)

Stops the file presentation.

Parameters:

NameTypeDefaultDescription
completion((_ error: NSError?) -> Void)?nilThe block to execute when the query completes.

image

image(page: Int): URL?

Provides the image's URL that refers to a specific page of the presented file.

Parameters:

NameTypeDescription
pageIntThe page number that corresponds to the currently presented page of the shared file.

Returns: URL?


thumbnail

thumbnail(page: number): URL?

Provides the thumbnail's URL that refers to a specific page of the presented file.

Parameters:

NameTypeDescription
pageIntThe number of the presented page. Files that do not include any pages, for example jpg images, require setting the value of this parameter to 0.

Returns: URL?