Skip to content

Usage

addEventListener(name: SdkEventListener, callback: Function): void

Registers a callback to be run when the event is triggered.

  • name: the event to listen to
  • callback: the callback to run when the event is triggered

Events you can listen to:

Event nameDescription
captiontrackchangeTriggered when the current caption track is updated
chapterchangeTriggered when the current chapter changes
endedTriggered when the playback ends
layoutchangeTriggered when the layout changes
liveStateTriggered when the state of a live event changes
pauseTriggered when the playback pauses
playTriggered when the playback resumes
playbackratechangeTriggered when the playback rate changes
primarycontentchangeTriggered when the primary content is updated
readyTriggered when the SDK is ready
timeupdateTriggered when the current time is updated
volumechangeTriggered when the volume changes

destroy(): void

Destroys the whole SDK.

disableCaptionTrack(): void

Disables the caption track.

enableCaptionTrack(language: string): void;

Sets the current caption track.

  • language: the language of the active track. Use null to disable captions.

getAudienceReactions(): Promise<string[]>

Gets the available audience reactions for the live event.

getCaptionTracks(): Promise<SdkCaptionTrack[]>

Gets the available caption tracks.

getChapters(): Promise<Chapter[]>

Gets the list of chapters for the presentation.

getCurrentChapter(): Promise<Chapter>

Gets the current chapter.

getCurrentCaptionTrack(): Promise<SdkCaptionTrack>

Gets the current caption track.

getCurrentTime(): Promise<number>

Gets the current time in milliseconds.

getDuration(): Promise<number>

Gets the presentation’s duration in milliseconds.

getLayout(): Promise<string>

Gets the layout.

getLiveEndTime(): Promise<string | null>

Gets the end date of a live event.

getLiveStartTime(): Promise<string | null>

Gets the start date of a live event.

getLiveState(): Promise<string | null>

Gets the state of a live event.

getPictureInPicturePosition(): Promise<‘bottom-left’ | ‘bottom-right’ | ‘top-left’ | ‘top-right’>

Gets the position of the PiP box.

getPlaybackRate(): Promise<number>

Gets the playback rate.

getPlaybackRates(): Promise<number>

Gets the list of playback rates.

getPresentation(): Promise<Presentation>

Gets the presentation.

getPrimaryContent(): Promise<‘media’ | ‘slides’>

Gets the primary content.

getSideBySideRatio(): Promise<number>

Gets the side by side ratio between 50% and 80%.

getVolume(): Promise<number>

Gets the player’s volume between 0 and 100.

isPaused(): Promise<boolean>

Checks whether the player is paused or playing.

pause(): void;

Pauses the player.

play(): void;

Plays the player.

removeEventListener(name: string, callback?: Function): void

Removes the callback for the provided event name.

  • name: the event name to listen to
  • callback: the callback to remove. If no callback is provided, all callbacks will be removed for the event name

sendAudienceReaction(reaction: string): void;

Sends the Audience Reaction.

  • reaction: the reaction

In order for the reaction to be visible in the player and analytics, you need to ensure the following:

  • The reaction must be available to the live event (see sdk.getAudienceReactions())
  • The live event must be ongoing and the playback is visible in the player

setCurrentTime(time: number): void;

Sets the current time in the player.

  • time: the new current time in milliseconds

setLayout(layout: ‘pip’ | ‘sbs’): void;

Sets the layout.

  • layout: the new layout

setPictureInPicturePosition(position: ‘bottom-left’ | ‘bottom-right’ | ‘top-left’ | ‘top-right’): Promise<void>

Sets the position of the PiP box.

  • position: the new position

setPlaybackRate(time: number): void;

Sets the playback rate in the player.

  • playbackRate: the new playback rate.The range is 0-2.

setPrimaryContent(content: ‘media’ | ‘slides’): void;

Sets the primary content.

  • content: the new primary content

setSideBySideRatio(ratio: number): void;

Sets the ratio for the Side by Side mode.

  • ratio: The new ratio. The range is 50-80.

setVolume(volume: number): void;

Sets the volume in the player.

  • volume: The new volume. The range is 0-100.