Techdocs

AMP Web SDK

AMP player

akamai.amp.AudioTrackList

The resource object interface.

Extends

Methods

add

add(track)

Add a track to the track list

Parameters
Name Type Description
track akamai.amp.Track

The track

Inherited From:

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:

clear

clear()

Remove all tracks from the track list

Inherited From:

destroy

destroy()

Destroys the EventDispatcher

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:

getTrackById

getTrackById(id) → {akamai.amp.Track}

Retrieve a track with a given id.

Parameters
Name Type Description
id string

The id

Inherited From:
Returns
akamai.amp.Track

track The track

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:

remove

remove(track)

Remove a track from the track list

Parameters
Name Type Description
track akamai.amp.Track

The module's key

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:

selectTrackByIndex

selectTrackByIndex(id)

Marks as active an audio track with a given id.

Parameters
Name Type Description
id number

The track id

selectTrackByLanguage

selectTrackByLanguage(lang)

Selects an audio track with a given language label.

Parameters
Name Type Description
lang string

The language label, must match the language property from a HTML media audio track.