Video.js: Add callback to "addRemoteTextTrack" ?

Created on 28 Dec 2017  路  4Comments  路  Source: videojs/video.js

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 ?

Most helpful comment

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);
});

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

0xsven picture 0xsven  路  3Comments

d3x7r0 picture d3x7r0  路  4Comments

SolmazKh picture SolmazKh  路  4Comments

pblasi picture pblasi  路  3Comments

askaliuk picture askaliuk  路  3Comments