new OtvToolkit()
Fires:
Members
-
errorReporting
-
ErrorReportingobject through which error information can be accessed -
logProvider
-
LogProviderobject through which logs can be provided -
networkStatistics
-
NetworkStatisticsobject through which network statistics members can be accessed -
playbackStatistics
-
PlaybackStatisticsObject through which playback statistics members can be accessed -
renderingStatistics
-
RenderingStatisticsObject through which rendering statistics members can be accessed
Methods
-
_makeDrmController(drmConfig)
-
Convenience function to allow UT interception
Name Type Description drmConfigObject -
_statisticsFactory(player, type)
-
Convenience function to allow UT interception
Name Type Description playerObject typestring -
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 urlstring 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 typestring A case-sensitive string representing the event type to listen for.
listener* An object implementing the EventListener interface, or a JavaScript function.
optionsobject 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 urlstring 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 configConfiguration | string Configuration object, or string configuration field.
valuestring (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. -
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 sourceURLstring URL of the content
mimeTypestring 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 enableboolean -
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 timenumber A relative time, in seconds, based on the return value of the
duration()method is expectedcallbackfunction 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 potentialSourceToPreloadobject The predicted next source
-
removeEventListener(type, listener, options)
-
Removes an event listener previously registered with
OtvToolkit#addEventListenerName Type Description typestring 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 forAZapboolean 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 bandwidthinteger 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 widthinteger the width, in pixels, to cap the content.
heightinteger the height, in pixels, to cap the content.