GoogleAnalytics

Google Analytics tracking for MediaEvents

new GoogleAnalytics(PBSMediaEvents: any)
Parameters
PBSMediaEvents (any)
Instance Members
addMediaStartTracking(category, label, metric, actionOverride)
addMediaStopTracking(category, label, metric, actionOverride)
addMediaTracking(category, label, metric, actionOverrides?)
setTrackingFunction(fn)

PBSPlayer

An interface for binding to and interacting with an embedded PBS player

new PBSPlayer(options: object?)

Extends PBSMediaEvents

Parameters
options (object? = {}) Passes to PBSMediaEvents. See constructor.
Static Members
addPlugin(pluginName, plugin)
Instance Members
destroy()
setPlayer(playerFrame)

PBSMediaEvents

Triggers media events based on the messages sent from a PBS Player

new PBSMediaEvents(options: object?)

Extends PBSMessageAPI

Parameters
options (object? = {}) Passes to PBSMessageAPI. See constructor.
Instance Members
destroy()
setPlayer(playerFrame)

destroy

Destroys the messaging channel for the PBSMessageAPI so that the event handler that traps messages does not exist continually. Removes all bound events from the underlying player element

destroy()

getDuration

Requests the currently playing player's duration in seconds.

getDuration(): Promise<int>
Returns
Promise<int>:

getMute

Requests the player's current audio muting state.

getMute(): Promise<boolean>
Returns
Promise<boolean>:

getPosition

Requests the current playback position in seconds.

getPosition(): Promise<int>
Returns
Promise<int>:

getState

Requests the player's current playback state.

getState(): Promise<(string | null)>
Returns
Promise<(string | null)>:

getVolume

Requests the current playback volume percentage, as a number from 0 to 100.

getVolume(): Promise<int>
Returns
Promise<int>:

isComplete

Helper method to check if the player is at the end of a video

isComplete(): Promise<boolean>
Returns
Promise<boolean>:

isPlaying

Helper method to check if the player is in the play state

isPlaying(): Promise<boolean>
Returns
Promise<boolean>:

isSeeking

Helper method to check if the player is currently seeking

isSeeking(): Promise<boolean>
Returns
Promise<boolean>:

off

Simple proxy method for unbinding events

off(event: String, handler: Function): PBSMessageAPI
Parameters
event (String) The name of the event to unbind from
handler (Function) The function to unbind from the event
Returns
PBSMessageAPI:

on

Simple proxy method for binding events

on(event: String, handler: Function): PBSMessageAPI
Parameters
event (String) The name of the event to bind
handler (Function) The function to bind to the event
Returns
PBSMessageAPI:

pause

Requests that the player changes to the paused state. Resolves to null.

pause(): Promise<null>
Returns
Promise<null>:

play

Requests that the player changes to the playing state. Resolves to null.

play(): Promise<null>
Returns
Promise<null>:

seek

Jump to the specified position within the currently playing item. The position is required and must be provided as an integer, in seconds.

seek(position: Number): Promise<null>
Parameters
position (Number) The position to seek to
Returns
Promise<null>:

setMute

Change the player's mute state (no sound). Toggles between muted and not muted.

setMute(muted: Boolean): Promise<null>
Parameters
muted (Boolean)
Returns
Promise<null>:

setVolume

Sets the player's audio volume percentage, as a number between 0 and 100.

setVolume(volumePercentage: Number): Promise<null>
Parameters
volumePercentage (Number) The volume to set the player to
Returns
Promise<null>:

stop

Stops the player (returning it to the idle state) and unloads the currently playing media file.

stop(): Promise<null>
Returns
Promise<null>:

togglePlayState

Requests that the player toggle the play state. If the player is in the playing state, it should switch to the paused state. If the player is in the paused state it should switch to the playing state. Resolves to null.

togglePlayState(): Promise<null>
Returns
Promise<null>:

trigger

Simple proxy method for unbinding events

trigger(event: String, handler: Function): PBSMessageAPI
Parameters
event (String) The name of the event to unbind from
handler (Function) The function to unbind from the event
Returns
PBSMessageAPI: