Web SDK

Firework provides programmatic access to certain features via its Web SDK available on `window._fwn`

Player

_fwn.player

Provides programmatic control to a "current" player. The "Current" player occupies either a fullscreen or minimized spot on a page. There can be only one "current" player at a time.

Note: Each Storyblock has its own player which will become the "current" player as soon as it's minimized or turned into a fullscreen one.

Attribute/MethodDescription

close()

Will close the current player either by discarding it or moving back into context (storyblock

minimize()

Will minimize current player into a floating mode. Turns PIP if applicable.

fullscreen()

Turns the current player into fullscreen mode.

currentTime

Will provide get/set access to the current time.

Example:

// Seek to the beginning of a current video
document.querySelector("button.seek").onClick = function() {
    window._fwn.player.currentTime = 0 // Seek to the beginning
}

// Programatically close the player
document.querySelector("button.close").addEventListener("click", function() {
    window._fwn.player.close()
})

Storyblock players

_fwn.players[name]

Storyblock's player can be accessed by referencing the player from the list of all players using the widget's name. The interface to Storyblock's player is identical to the "current" player (see the table above).

Example:

// Integration with `name` attribute
<fw-storyblock name="my-storyblock" channel="my-channel-name"></fw-storyblock>
// Seek to the beginning of a current video
document.querySelector("button.seek").onClick = function() {
    window._fwn.players['my-storyblock'].currentTime = 0 // Seek to the beginning
}

Last updated