Interface

interfaces/Player

interfaces/Player

The media player interface Implement this interfaces and register to media/playerRegistry.

Members

Number

# static MAX_COUNT

Maximum number of player instances allowed to be created in the XDK application

Boolean

# static PRELOADABLE

When true, this player supports media.preload, i.e. load in background while other player is active. When false, fallback approach media.prepareLoadOption should be used. Preload process: mediaManager.preload -> media.load -> media.play

Boolean

# static SINGLE_PLAYER_ONLY

When true, this player has to be the only active player in XDK, other player has to be deinited before using this player. On the other hand, this player has to be deinited if we choose to use other player

Methods

# doRestore(suspendOption) → {Promise.<Boolean>}

Restore handler for the player

Parameters:
Name Type Description
suspendOption Object

the saved option in suspended state

Promise. Boolean to check if player should do playback handling

Promise.<Boolean>

# doSuspend() → {Promise}

Suspend handler for the player

Promise.

Promise

# getBitrates() → {interfaces/Player~MediaBitrates}

Get the media bitrates

current bitrate and available bitrates

interfaces/Player~MediaBitrates

# getCapabilities() → {interfaces/Player~PlayerCapabilities}

Gets the player's capabilities

the player's capabilities

# getCurrentTime() → {Number}

Get the current playback time

the current playback time

Number

# getDuration() → {Number}

Get the total playback time

the total playback time

Number

# getExtensionManager() → {media/extensionManager}

get the extension Manager

the player extension manager

media/extensionManager

# getId() → {String}

Get back the path

the path of the player

String

# getPlaybackSpeed() → {Number}

Get the playback speed

the playback speed

Number

# getPlayerConfig() → {Object}

Gets the player's config

the player's configuration

Object

# getPlayerObject() → {Object}

Gets the player's object

the player's configuration

Object

# getVideoSize() → {interfaces/Player~VideoSize}

Get the stream size

the size of the video

interfaces/Player~VideoSize

# isPrepared() → {Boolean}

Indicate if the player is prepared and ready to load and play

if player is prepared

Boolean

# async load(mediaURL, optionopt)

Loads the specified media

Parameters:
Name Type Attributes Description
mediaURL String

the URL address of the media

option Object <optional>

the options for loading this media

protocol string <optional>

the media protocol

drm string <optional>

DRM to be used

# pause() → {Boolean}

Pause the playback

True when preform successfully

Boolean

# async play(secondopt) → {Boolean}

Start the playback

Parameters:
Name Type Attributes Description
second Number <optional>

the playback start time

True when preform successfully

Boolean

# async prepare(optionopt)

Prepare the player, should be called before using. Must do a dynamic load of external players like shaka or hls.js

Parameters:
Name Type Attributes Description
option string <optional>

The media type to be played

protocol string <optional>

The media protocol

drm string <optional>

DRM to be used

# reset()

Reset the player, should be called when it is to replaced by other player

# resume() → {Boolean}

Resume the playback

True when preform successfully

Boolean

# seek(second) → {Boolean}

Seek to specifiy position of the video

Parameters:
Name Type Description
second Number

the position to seek to in seconds

True when preform successfully

Boolean

# setFullscreen()

Sets video window size to be fullscreen

# setId(id)

set the id of the player

Parameters:
Name Type Description
id String

the path of the player

# setVideoDisplayMode(mode)

Sets the video display mode

Parameters:
Name Type Description
mode NONE | ZOOM | FIT | FILL

XDK set Video Display mode

# setVideoSizeAndPosition(param)

Sets video window size

Parameters:
Name Type Description
param Object

window size parameter

top Integer

window top

left Integer

window left

width Integer

window width

height Integer

window height

# skip(second) → {Boolean}

Skip the playback forward/backward for certain seconds

Parameters:
Name Type Description
second Number

the skip second

True when preform successfully

Boolean

# speed(speed) → {Boolean}

Speed up/down the media playback

Parameters:
Name Type Description
speed Number

the playback speed to set

True when preform successfully

Boolean

# stop() → {Boolean}

Stop the playback

True when preform successfully

Boolean

Type Definitions

object

# MediaBitrates

the media's bitrates

Properties:
Name Type Attributes Description
currentBitrate Array <optional>

current playback bitrate

availableBitrates Array <optional>

available playback bitrates

object

# VideoSize

the media's size

Properties:
Name Type Description
width Number

the video width

height Number

the video height

object

# PlayerCapabilities

the player's capabilities

Properties:
Name Type Description
drm Array

Player supported DRM e.g.["playready","widevine", "aes-128", "wmdrm"]

protocol Array

Player'supported protocol. e.g. ["progressive","hls", "dash", "smooth-streaming"]

Example
{
     "drm" : [ "playready", "widevine", "aes-128", "wmdrm" ],
     "protocol" : [ "progressive", "hls", "dash", "smooth-streaming" ]
}