Idrizi.A
Idrizi.A

Reputation: 12060

showTextTrack in Video.js 5

I am trying to change the active caption track from JavaScript in Video.js v5.10.4. I saw a few posts about this and they all suggested to use showTextTrack, but when I execute the command it says that showTextTrack is not a function. I currently have the following code

var video = videojs('video');
var first_track_id = video.textTracks().tracks_[0].id; // this returns vjs_track_399
video.showTextTrack(first_track_id, "captions"); // this returns the error above

Is there any other way to accomplish what I am trying to do, or what am I doing wrong?

Upvotes: 0

Views: 74

Answers (1)

misterben
misterben

Reputation: 7821

showTextTracks() was for video.js 4. Now you just set the mode of the track to showing:

video.textTracks()[0].mode = 'showing';

Upvotes: 1

Related Questions