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

SubtitleTrackController

Extends:

src/event-handler.js~EventHandler → SubtitleTrackController

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

media: *

public

Keeps reference to a default track id when media has not been attached yet

public
public
public
public get

get index of the selected subtitle track (index in subtitle track lists) *

public set

select a subtitle track, based on its index in subtitle track lists*

public get

get alternate subtitle tracks list from playlist *

public

timer: *

public
public

trackId: *

public

tracks: *[]

public

Method Summary

Public Methods
public
public

onManifestLoaded(data: *)

public

onMediaAttached(data: *)

public
public
public
public
Private Methods
private
private
private
private

This method is responsible for validating the subtitle index and periodically reloading if live.

private

_toggleTrackModes(newId: *)

Disables the old subtitleTrack and sets current mode on the next subtitleTrack.

Public Constructors

public constructor() source

Public Members

public media: * source

public queuedDefaultTrack: * source

Keeps reference to a default track id when media has not been attached yet

public stopped: boolean source

public subtitleDisplay: boolean source

public subtitlePollingInterval: * source

public get subtitleTrack: * source

get index of the selected subtitle track (index in subtitle track lists) *

public set subtitleTrack source

select a subtitle track, based on its index in subtitle track lists*

public get subtitleTracks: * source

get alternate subtitle tracks list from playlist *

public timer: * source

public trackChangeListener: * source

public trackId: * source

public tracks: *[] source

public useTextTrackPolling: * source

Public Methods

public destroy() source

public onManifestLoaded(data: *) source

Params:

NameTypeAttributeDescription
data *

public onMediaAttached(data: *) source

Params:

NameTypeAttributeDescription
data *

public onMediaDetaching() source

public onSubtitleTrackLoaded(data: *) source

Params:

NameTypeAttributeDescription
data *

public startLoad() source

public stopLoad() source

Private Methods

private _clearReloadTimer() source

private _loadCurrentTrack() source

private _onTextTracksChanged() source

private _setSubtitleTrackInternal(newId: *) source

This method is responsible for validating the subtitle index and periodically reloading if live. Dispatches the SUBTITLE_TRACK_SWITCH event, which instructs the subtitle-stream-controller to load the selected track.

Params:

NameTypeAttributeDescription
newId *

The id of the subtitle track to activate.

private _toggleTrackModes(newId: *) source

Disables the old subtitleTrack and sets current mode on the next subtitleTrack. This operates on the DOM textTracks. A value of -1 will disable all subtitle tracks.

Params:

NameTypeAttributeDescription
newId *

The id of the next track to enable