akamai.amp.HTMLPlayer

The HTML5 player class.

Constructor

HTMLPlayer

new HTMLPlayer()

Extends

Members

absoluteCurrentTime

:number

The playhead time in seconds without any time transformations applied.

Inherited From:

absoluteDuration

(readonly) :number

The duration of the video in seconds without any time transformations applied.

Inherited From:

audioTracks

(readonly) :akamai.amp.TrackList

A list of audio tracks associated with the current video.

Inherited From:

autoplay

:boolean

The autoplay flag.

Inherited From:

autoplayPolicy

(readonly) :akamai.amp.AutoplayPolicy

The autoplay mode

Inherited From:

autoplayThreshold

(readonly) :akamai.amp.AutoplayThreshold

The browser's autoplay threshold

Inherited From:

bottom

(readonly) :number

The bottom position of the player container in pixels.

Inherited From:

buffering

(readonly) :boolean

The buffering flag.

Inherited From:

busy

:boolean

The player's busy state. Used to show the busy UI for situations outside of the video waiting event.

Inherited From:

captioning

:akamai.amp.Captioning

The captioning API

Inherited From:

config

(readonly) :akamai.amp.PlayerConfig

The player's configuration object.

Inherited From:

container

:HTMLElement

The player's container div.

Inherited From:

cues

:Array.<akamai.amp.Cue>

A list of cue points associated with the video content.

Inherited From:

currentTime

:number

The current time of the video in seconds. Used to seek or retrive the playhead time.

Inherited From:

debug

(readonly) :boolean

Indicates whether or not the player is operating in debug mode.

Inherited From:

defaultMediaTransform

(readonly) :function

The default media transformation.

Inherited From:

displayState

:akamai.amp.DisplayState

The player's display state.

Inherited From:

duration

(readonly) :number

The duration of the video in seconds.

Inherited From:

ended

(readonly) :boolean

Indicates whether or not the player has reached the end of content

Inherited From:

error

(readonly) :Error

The last error the player encountered since loading the video content

Inherited From:

height

(readonly) :number

The height of the player container in pixels.

Inherited From:

hidden

:boolean

Flag indicating whether the player is showing or hidden.

Inherited From:

isLive

(readonly) :boolean

Indicates whether or not the stream is playing at the live edge.

Inherited From:

language

:string

The player language (IETF language tag). Used to localize UI text and set default caption language.

Inherited From:

left

(readonly) :number

The left position of the player container in pixels.

Inherited From:

loop

:boolean

The loop flag.

Inherited From:

media

:akamai.amp.Media

The media object for the video to play.

Inherited From:

mediaElement

(readonly) :HTMLObject|HTMLMediaElement

The media playback DOM element.

Inherited From:

mode

(readonly) :akamai.amp.PlaybackMode

The playback mode.

Inherited From:

mouseOver

(readonly) :boolean

The mouse over flag.

Inherited From:

mouseX

(readonly) :number

The x position of the mouse within the player container in pixels.

Inherited From:

mouseY

(readonly) :number

The y position of the mouse within the player container in pixels.

Inherited From:

muted

:boolean

The player's muted value.

Inherited From:

params

:Object

Customer provided parameters.

Inherited From:

paused

(readonly) :boolean

Indicates whether or not the player is paused

Inherited From:

playbackRate

:number

The playback rate. 1 represents normal playback speed, 2 double speed, 0.5 half speed, etc.

Inherited From:

playbackTarget

:string

The playback target of the video content. i.e. "amp", "chromecast", "airplay", etc.

Inherited From:

preload

:akamai.amp.Preload

The preload value.

Inherited From:

previewTracks

(readonly) :akamai.amp.TrackList

A list of preview tracks associated with the current video.

Inherited From:

quality

:number

The current quality level (bitrate).

Inherited From:

qualityLevels

(readonly) :Array

A list of available quality levels associated with the video content.

Inherited From:

qualityMode

:akamai.amp.QualityMode

The quality mode.

Inherited From:

The right position of the player container in pixels.

Inherited From:

seeking

(readonly) :boolean

Indicates whether or not the player is seeking

Inherited From:

settings

(readonly) :akamai.amp.Settings

The user settings object

Inherited From:

source

:Array.<akamai.amp.Resource>

An array of source objects for the player to choose from.

Inherited From:

src

:string

The source url of the video to play.

Inherited From:

textTracks

(readonly) :akamai.amp.TrackList

A list of text tracks associated with the current video.

Inherited From:

timers

(readonly) :akamai.amp.TimerGroup

The timer group

Inherited From:

top

(readonly) :number

The top position of the player container in pixels.

Inherited From:

version

(readonly) :string

The player version

Inherited From:

videoHeight

(readonly) :number

The encoded height of the video content currently playing in pixels.

Inherited From:

videoWidth

(readonly) :number

The encoded width of the video content currently playing in pixels.

Inherited From:

volume

:number

The player's volume. Must be a number between 0 and 1.

Inherited From:

waiting

(readonly) :boolean

Flag indicating whether or not the player is waiting for media content.

Inherited From:

width

(readonly) :number

The width of the player container in pixels.

Inherited From:

Methods

addEventListener

addEventListener(typenon-null, funcnon-null)

Adds a listener for a given event type.

Parameters
Name Type Description
type string

A string representing the event's type.

func function

A function to call when the event is triggered.

Inherited From:

addListener

addListener()

Alias of addEventListener

Inherited From:

addTransform

addTransform(typenon-null, transform)

Adds a transform for a given type.

Parameters
Name Type Description
type string

A string representing the event's type.

transform function | akamai.amp.Transform

A function to call when the event is triggered.

Inherited From:
Tutorials:
  • Tutorial: {6-media-transforms}
See:

canPlayType

canPlayType(type) → {string}

Determines if the core can play a given mimeType.

Parameters
Name Type Description
type string

The mimetype to check.

Inherited From:
Returns
string

destroy

destroy()

Destroys the player.

Inherited From:

dispatch

dispatch(type, detailopt)

Dispathes and event, triggering all event listener of the event's type.

Parameters
Name Type Attributes Description
type string

The event to type.

detail Object <optional>

Object representing event specific details.

Inherited From:

dispatchEvent

dispatchEvent(eventnon-null)

Dispathes and event, triggering all event listener of the event's type.

Parameters
Name Type Description
event Event

The event to dispatch.

Inherited From:

emit

emit()

Alias of dispatch

Inherited From:

end

end()

Ends video playback.

Inherited From:

enterFullScreen

enterFullScreen()

Enters the player into full screen mode.

Inherited From:

evaluateBindings

evaluateBindings(binding) → {Object}
Parameters
Name Type Description
binding Object

A data bound string or object to evaluate.

Inherited From:
Returns
Object

The evaluated result

exitFullScreen

exitFullScreen()

Exits the player out of full screen mode.

Inherited From:

fromUTC

fromUTC(value) → {number}

Converts a playhead time from UTC to seconds if available

Parameters
Name Type Description
value number

The playhead time in UTC

Inherited From:
Returns
number

The playhead time in seconds

getLocalizedString

getLocalizedString(value, contextopt) → {string}

Get a localized string.

Parameters
Name Type Attributes Description
value string

The localized string id

context context <optional>

A context object providing additional variable to bound templates

Inherited From:
Returns
string

The localized string

goLive

goLive()

Forces to stream to play from the live edge.

Inherited From:

load

load()

Loads the video.

Inherited From:

loadResources

loadResources(resources, callback) → {Promise}

Loads a list of JS and CSS resources.

Parameters
Name Type Description
resources Array.<akamai.amp.Resource>

The list of js and css resources

callback function
Inherited From:
Returns
Promise

Promise which resolves once all resources have been loaded.

mute

mute()

Mutes the player.

Inherited From:

off

off()

Alias of removeEventListener

Inherited From:

on

on()

Alias of addEventListener

Inherited From:

once

once(typenon-null, funcnon-null)

Adds a listener for a given event type that is called once, then removed.

Parameters
Name Type Description
type string

A string representing the event's type.

func function

A function to call when the event is triggered.

Inherited From:

pause

pause() → {Promise}

Pauses the currently loaded video.

Inherited From:
Returns
Promise

play

play() → {Promise}

Plays the currently loaded video.

Inherited From:
Returns
Promise

recordContentChange

recordContentChange(content)

Records a content change

Parameters
Name Type Description
content Object

An object representing the new content

Inherited From:

removeEventListener

removeEventListener(typenon-null, funcnon-null) → (nullable) {function}

Removes a listener for a given event type.

Parameters
Name Type Description
type string

A string representing the event's type.

func function

A function to call when the event is triggered.

Inherited From:
Returns
function

the handler that was removed if any

removeListener

removeListener()

Alias of removeEventListener

Inherited From:

removeTransform

removeTransform(typenon-null, transform) → {function|akamai.amp.Transform}

Removes a transform for a given type.

Parameters
Name Type Description
type string

A string representing the tranform's type.

transform function | akamai.amp.Transform

A function or Transform object to call when the type is triggered.

Inherited From:
See:
Returns
function | akamai.amp.Transform

the transform that was removed if any

replay

replay()

Plays the currently loaded video from its start time.

Inherited From:

request

request(options) → {Promise.<XHR>}

Request a http resource.

Parameters
Name Type Description
options string | akamai.amp.Request

A url object or string.

Inherited From:
Returns
Promise.<XHR>

Promise which resolves to a XHR object

seek

seek(value) → {Promise}

Sets the current time of the video.

Parameters
Name Type Description
value

The playhead time in seconds

Inherited From:
Returns
Promise

sortTransforms

sortTransforms(typenon-null, sortopt) → {Array.<(function()|akamai.amp.Transform)>}

Sorts the transform list by priority. Higher priority Transforms are executed first.

Parameters
Name Type Attributes Description
type string

The tranform type

sort function <optional>

An optional sort function

Inherited From:
See:
Returns
Array.<(function()|akamai.amp.Transform)>

The sorted list of transforms

toUTC

toUTC(value) → {number}

Converts a playhead time from seconds to UTC if available

Parameters
Name Type Description
value number

The playhead time in seconds

Inherited From:
Returns
number

The playhead time in UTC

transform

transform(typenon-null, valuenon-null) → {Promise}

Performs a transform for a given type

Parameters
Name Type Description
type string

The tranform type

value Object

The value to be transformed

Inherited From:
See:
Returns
Promise

unmute

unmute()

Unmutes the player.

Inherited From: