Subtitle Events
Subtitle events are dispatched on source Event Bus which can be accessed on source API under events
namespace.
//...
const sourceApi = player.sources.add(sourceConfig);
sourceApi.events.on('subtitle-track-available', (event) => console.info('Subtitle available', event));
sourceApi.events.on('subtitle-track-activated', (event) => console.info('Subtitle enabled', event));
sourceApi.events.on('subtitle-track-deactivated', (event) => console.info('Subtitle enabled', event));
sourceApi.events.on('subtitle-cue-parsed', (event) => console.info('Cue parsed', event));
sourceApi.events.on('subtitle-cue-enter', (event) => console.info('Cue enter', event));
sourceApi.events.on('subtitle-cue-exit', (event) => console.info('Cue exit', event));
Full list of subtitle and cue events, and its types can be found in the documentation.
- Track Available: Dispatched once track has been parsed from manifest or when external track has been added.
- Track Unavailable: Dispatched once track (external track) has been removed.
- Track Activated: Dispatched once track has been set as active.
- Track Deactivated: Dispatched once track has been set as inactive.
- Cue Parsed: Dispatched once cues of active track has been parsed.
- Cue Enter: Dispatched once playback time has reached the cue start time and cue is active.
- Cue Exit: Dispatched once playback reached the end of active cue.
Updated 2 months ago