I would like to get the cues from the chapters file loaded in my Video.js object. I've already find how to get the track but I need its id
in order to access it.
player.textTracks().getTrackById(<trackID>);
I found out where the id
is defined in the Video.js 5.14.0 library:
// video.js/dist/video.js (line 19195)
var trackProps = {
id: options.id || 'vjs_track_' + Guid.newGUID(),
kind: options.kind || '',
label: options.label || '',
language: options.language || ''
};
It seems that you can define your own id
by passing an object to the function:
// video.js/dist/video.js (line 19178)
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
I load the chapter track as follow:
<track kind="chapters" src="chapters.vtt" srclang="en" default>
I've read that you can dynamically add track files but you will have to reload the Video.js object.