Hi there,
I was trying to do this:
player.addRemoteTextTrack({src: "www.example.com"}, false)
The above code is async, but we don't have a callback :sweat_smile:
Also I have a question, why loadTrack and parseCues in text-track.js is private, if we make it part of class TextTrack then people can do thing like this:
var x = new TextTrack
x.loadTrack(src, callback) // callback doesn't exist yet
Is there a special reason for private those ?
For better or worse, we currently rely on native-like behavior for the loading of the text tracks. addRemoteTextTrack returns either a native or an emulated HTMLTrackElement. On that object, you can then listen to the load event to know when the track has loaded. Seems like we're lacking in documentation of this.
Here's an example:
const trackEl = player.addRemoteTextTrack({src: 'en.vtt'}, false);
trackEl.addEventLisetner('load', function() {
// the object has a reference to the TextTrack object via the `track` property
console.log(trackEl.track.cues);
});
Thanks for the docs!
sorry, my internet is very laggy, two main under sea cable in my country AAG and APG got problem at the same time, I was thinking do the docs as you said next week, but anyway thanks for merge that
If you get around to it, that would be great!
Most helpful comment
For better or worse, we currently rely on native-like behavior for the loading of the text tracks.
addRemoteTextTrackreturns either a native or an emulated HTMLTrackElement. On that object, you can then listen to theloadevent to know when the track has loaded. Seems like we're lacking in documentation of this.Here's an example: