FilePresentationService

The FilePresentationService allows presenting files during a conference. The Dolby.io Communications APIs service converts provided files into multiple images that are accessible through the getImage method.

The file presentation workflow:

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

2. The presenter receives information about the converted file via the onFileConverted listener.

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

4. The presenter and the viewers receive information about the shared file via the onFilePresentationChange listener. This information should trigger calling the getImage 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 participants.

7. The presenter and viewers receive information about the updated file via the onFilePresentationChange listener with the current page number. This information should trigger calling the image method to display the proper page of the file.

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

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

10. The presenter and the viewers receive information about the end of the file presentation via the onFilePresentationChange listener.

Methods

convert

convert(file): Promise<FileConverted>

Converts a provided file into multiple images. The file is uploaded as FormData.

The supported file formats are:

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

After the conversion, the files are broken into individual images with a maximum resolution of 2560x1600.

When a file is converted and ready to be presented, the application receives the converted event.

Parameters

NameTypeDescription
fileFileThe file that a presenter wants to share during a conference.

Returns

Promise<FileConverted>


getCurrent

getCurrent(): Promise<FilePresentation>

Returns information about the current state of the file presentation.

Returns

Promise<FilePresentation>


getImage

getImage(page): Promise<string>

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

Parameters

NameTypeDescription
pagenumberThe number of the presented page. Files that do not have any pages, for example, jpg images, require setting the page value to 0.

Returns

Promise<string>


getThumbnail

getThumbnail(page): Promise<string>

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

Parameters

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

Returns

Promise<string>


setPage

setPage(page): Promise<void>

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

Parameters

NameTypeDescription
pagenumberThe page number that corresponds to the required page.

Returns

Promise<void>


start

start(file): Promise<void>

Starts a file presentation.

Parameters

NameTypeDescription
fileFileConvertedThe converted file that the presenter wants to share during the conference.

Returns

Promise<void>


stop

stop(): Promise<void>

Stops a file presentation.

Returns

Promise<void>


Event handlers

onFileConverted

onFileConverted(handler): UnsubscribeFunction

Adds a listener to the file converted event.

Parameters

NameTypeDescription
handler(data: FileConvertedEventType) => voidAn event callback function.

Returns

UnsubscribeFunction

A function that unsubscribes from event listeners.


onFilePresentationChange

onFilePresentationChange(handler): UnsubscribeFunction

Adds a listener to the file presentation changed event.

Parameters

NameTypeDescription
handler(data: FilePresentationChangedEventType, type?: FilePresentationStarted | FilePresentationStopped | FilePresentationUpdated) => voidAn event callback function.

Returns

UnsubscribeFunction

A function that unsubscribes from event listeners.


Did this page help you?