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

AudioTrackController

Extends:

src/task-loop.js~TaskLoop → 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
private

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

_selectAudioGroup(levelId: *)

private

Select initial track

private
private

Public Constructors

public constructor() source

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 _selectDefaultTrack: boolean source

private _trackId: * source

Public Methods

public doTick() source

public onAudioTrackLoaded(data: *) source

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

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

Params:

NameTypeAttributeDescription
data *

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 _selectAudioGroup(levelId: *) source

Params:

NameTypeAttributeDescription
levelId *

private _selectInitialAudioTrack() source

Select initial track

private _setAudioTrack(newId: number) source

Params:

NameTypeAttributeDescription
newId number

private _updateTrack(newId: number) source

Params:

NameTypeAttributeDescription
newId number