OpenTV Player Web HTML5

Class: OtvToolkit

OtvToolkit

Toolkit plugin which extends the player to provide advanced player features. Returned from the otvtoolkit() member of the player.

new OtvToolkit()

Fires:

Members

errorReporting

ErrorReporting object through which error information can be accessed

logProvider

LogProvider object through which logs can be provided

networkStatistics

NetworkStatistics object through which network statistics members can be accessed

playbackStatistics

PlaybackStatistics Object through which playback statistics members can be accessed

renderingStatistics

RenderingStatistics Object through which rendering statistics members can be accessed

Methods

_makeDrmController(drmConfig)

Convenience function to allow UT interception

Name Type Description
drmConfig Object

_statisticsFactory(player, type)

Convenience function to allow UT interception

Name Type Description
player Object
type string

addChapters(url)

Adds chapter markers and highlights to the seek bar, and chapter titles when hovering over a chapter in the seek bar.

Name Type Description
url string

URL of a webvtt file containing the chapter information.

addEventListener(type, listener, options)

Sets up a function that will be called whenever the specified event is emitted.

Name Type Description
type string

A case-sensitive string representing the event type to listen for.

listener *

An object implementing the EventListener interface, or a JavaScript function.

options object

An optional options object that specifies characteristics about the event listener.

addThumbnailPreview(url)

Adds thumbnail preview to the seek bar for the currently playing content

Name Type Description
url string

URL of a webvtt file containing the thumbnail images

configure(config, value){boolean}

Set the given configuration object on the player. See https://shaka-player-demo.appspot.com/docs/api/shaka.Player.html#configure for more details on the Configuration object and fields. If called before a player has been initialized this will return false. The SDK defaultly optimizes the segment timeout and maxAttempts with some default value or setting from source api. If application wants override these two specific settings, application can invoke this api after receive 'canplay' event.

Name Type Description
config Configuration | string

Configuration object, or string configuration field.

value string

(Optional) If config is a string configuration field, The desired value for that field.

Returns:
Type Description
boolean Whether the configuration was able to be set.

configureTextStyle(config)

Set the given text style configuration object.

Name Type Description
config object

JSON configuration object.

Name Type Description
textSizeScaleFactor number

The scaling factor for the text size.

fontFamily string

The font family for the text. https://developer.mozilla.org/en-US/docs/Web/CSS/font-family

textColor string

The font color (& opacity) for the text. https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_colors/Color_values

backgroundColor string

The background color (& opacity) for the text. https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_colors/Color_values

characterEdgeEffect string

The edge effect for the text, e.g. uniform, depressed, dropShadowed, raised or any valid text-shadow string. https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow

characterEdgeColor string

The edge effect color (& opacity). Works in conjunction with characterEdgeEffect.

createSourceObjectFromURL(sourceURL, mimeType){promise}

Builds a source object of the appropriate mime type from the URL of the video content The function can be used to create a source object with a known mime type. Note that calling this function is optional: The client can build a source object with a known URL and mime type Calling this function can result in additional network requests.

Name Type Description
sourceURL string

URL of the content

mimeType string optional

The mime type of the content (if known)

Returns:
Type Description
promise The source object and type

dispose()

Dispose any listeners connected to the otvtoolkit and tell the object it owns to dispose

enableAutoPiPInitiationOnScroll(enable)

Enables/disables the pip trigger when the video window scrolls into/out of view

Name Type Description
enable boolean

enablePiP()

Enables picture-in-page support, adding a button the control bar to initiate PiP and enabling auto-PiP initiation when the player scrolls out of the window.

getConfiguration(){Configuration|null}

Returns the current configuration object from the player. See https://shaka-player-demo.appspot.com/docs/api/shaka.extern.html#.PlayerConfiguration for details on Configuration object. If called before a player has been initialized this will return null.

Returns:
Type Description
Configuration | null The configuration object.

getThumbnail(time, callback){Thumbnail|null}

Return the thumbnail at time position.

Name Type Description
time number

A relative time, in seconds, based on the return value of the duration() method is expected

callback function

A Callback function provided when retrieving thumbnail

Returns:
Type Description
Thumbnail | null
  • Thumbnail for the given time position. It returns null in case there are is not a thumbnails representation or if it doesn't contain a thumbnail for the given time position.

preload(potentialSourceToPreload)

Allows for a predicted next zap to be preloaded for a quicker zap time.

Name Type Description
potentialSourceToPreload object

The predicted next source

removeEventListener(type, listener, options)

Removes an event listener previously registered with OtvToolkit#addEventListener

Name Type Description
type string

A string which specifies the type of event for which to remove an event listener.

listener *

The EventListener function of the event handler to remove

options *

An options object that specifies characteristics about the event listener.

reset(forAZap)

Clears up at the end of playing a stream. This could be due to a stop or setting a new source, so we will differentiate between the two.

Name Type Default Description
forAZap boolean false

If true, the reset is due to a zap

setMaxBandwidth(bandwidth)

Set the maximum bandwidth allowed for DASH streams. This is applied to the sum of the video and audio bitrates. You can remove the cap by setting the bandwidth to Infinity.

Name Type Description
bandwidth integer

the bandwidth in bits/sec, to cap the content

setMaxResolution(width, height)

Set the maximum resolution allowed for DASH streams. You can remove the cap by setting the width and height to Infinity.

Name Type Description
width integer

the width, in pixels, to cap the content.

height integer

the height, in pixels, to cap the content.