Home Reference Source
import AudioTrackController from 'hls.js/src/controller/audio-track-controller.js'
public class | source

AudioTrackController

Extends:

EventHandlerTaskLoop → AudioTrackController

Implements:

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public get
public set

Select current track by index

public get

audioTracks: AudioTrack[]

public
public

tracks: *[]

Private Members
private

trackId: *

Method Summary

Public Methods
public

doTick()

public

Store track details of loaded track in our data-model.

public

Update the internal group ID to any audio-track we may have set manually or because of a failure-handling fallback.

public

onError(data: ErrorEventData)

Handle network errors loading audio track manifests and also pausing on any netwok errors.

public

onLevelLoaded(data: *)

When a level gets loaded, if it has redundant audioGroupIds (in the same ordinality as it's redundant URLs) we are setting our audio-group ID internally to the one set, if it is different from the group ID currently set.

If group-ID got update, we re-select the appropriate audio-track with this group-ID matching the currently selected one (based on NAME property).

public

Reset audio tracks on new manifest loading.

public

onManifestParsed(data: *)

Store tracks data from manifest parsed data.

Private Methods
private
private

_loadTrackDetailsIfNeeded(audioTrack: AudioTrack)

private

_needsTrackLoading(audioTrack: AudioTrack): boolean

private

Select initial track

private

Inherited Summary

From class EventHandler
public
public

hls: *

public
public
public
public

onEvent(event: *, data: *)

arguments: event (string), data (any)

public

onEventGeneric(event: *, data: *)

public
public
public
public
From class TaskLoop
private
private
private
private
public
public
public abstract

doTick()

For subclass to implement task logic

public
public
public
public
public

tick()

Will call the subclass doTick implementation in this main loop tick or in the next one (via setTimeout(,0)) in case it has already been called in this tick (in case this is a re-entrant call).

Public Constructors

public constructor() source

Override:

TaskLoop#constructor

Public Members

public audioGroupId: * source

public get audioTrack: number source

public set audioTrack source

Select current track by index

public get audioTracks: AudioTrack[] source

public trackIdBlacklist: * source

public tracks: *[] source

Private Members

private trackId: * source

Public Methods

public doTick() source

For subclass to implement task logic

Override:

TaskLoop#doTick

public onAudioTrackLoaded() source

Store track details of loaded track in our data-model.

Set-up metadata update interval task for live-mode streams.

public onAudioTrackSwitched(data: *) source

Update the internal group ID to any audio-track we may have set manually or because of a failure-handling fallback.

Quality-levels should update to that group ID in this case.

Params:

NameTypeAttributeDescription
data *

public onError(data: ErrorEventData) source

Handle network errors loading audio track manifests and also pausing on any netwok errors.

Params:

NameTypeAttributeDescription
data ErrorEventData

public onLevelLoaded(data: *) source

When a level gets loaded, if it has redundant audioGroupIds (in the same ordinality as it's redundant URLs) we are setting our audio-group ID internally to the one set, if it is different from the group ID currently set.

If group-ID got update, we re-select the appropriate audio-track with this group-ID matching the currently selected one (based on NAME property).

Params:

NameTypeAttributeDescription
data *

public onManifestLoading() source

Reset audio tracks on new manifest loading.

public onManifestParsed(data: *) source

Store tracks data from manifest parsed data.

Trigger AUDIO_TRACKS_UPDATED event.

Params:

NameTypeAttributeDescription
data *

Private Methods

private _handleLoadError() source

private _loadTrackDetailsIfNeeded(audioTrack: AudioTrack) source

Params:

NameTypeAttributeDescription
audioTrack AudioTrack

private _needsTrackLoading(audioTrack: AudioTrack): boolean source

Params:

NameTypeAttributeDescription
audioTrack AudioTrack

Return:

boolean

private _selectInitialAudioTrack() source

Select initial track

private _updateTrack(newId: number) source

Params:

NameTypeAttributeDescription
newId number