{"action":"created","issue":{"url":"https://api.github.com/repos/videojs/video.js/issues/2369","labels_url":"https://api.github.com/repos/videojs/video.js/issues/2369/labels{/name}","comments_url":"https://api.github.com/repos/videojs/video.js/issues/2369/comments","events_url":"https://api.github.com/repos/videojs/video.js/issues/2369/events","html_url":"https://github.com/videojs/video.js/issues/2369","id":95574009,"number":2369,"title":"Handle switching between sets of text tracks","user":{"login":"heff","id":166,"avatar_url":"https://avatars.githubusercontent.com/u/166?v=3","gravatar_id":"","url":"https://api.github.com/users/heff","html_url":"https://github.com/heff","followers_url":"https://api.github.com/users/heff/followers","following_url":"https://api.github.com/users/heff/following{/other_user}","gists_url":"https://api.github.com/users/heff/gists{/gist_id}","starred_url":"https://api.github.com/users/heff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heff/subscriptions","organizations_url":"https://api.github.com/users/heff/orgs","repos_url":"https://api.github.com/users/heff/repos","events_url":"https://api.github.com/users/heff/events{/privacy}","received_events_url":"https://api.github.com/users/heff/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-07-17T02:58:37Z","updated_at":"2015-07-17T21:27:59Z","closed_at":null,"body":"When switching to a new source (or reloading the same source) we need a solution for loading/reloading the set of text tracks. We may already have method we suggest so let me know if that's the case.\r\n\r\n@dsparacio brought this to my attention. He's running into an issue with the integration between dash.js and video.js. Dash.js adds tracks to the video element using videoEl.addTextTrack. There is no videoEl.removeTextTrack, so when you reload the source or add a new source dash.js disables the existing tracks and creates new ones for the new tracks.\r\n\r\nVideo.js shows all tracks in the track menu, including disabled tracks, which in this case means showing tracks that no longer apply. It appears as multiple tracks for the same language, even though only the last is meant to be used.\r\n![b2f5dc7a-4b1f-423a-9dbf-5277f13b0cb5](https://cloud.githubusercontent.com/assets/166/8739555/02261e96-2bf2-11e5-9765-6711365e198f.png)\r\n\r\n(side note, we need to make it more obvious that you can scroll down in menus like this)\r\n\r\nHe suggested ignoring disabled tracks. Here's my response and the rest of our discussion.\r\n\r\n> We can't really ignore disabled tracks in the menu because disabled is the only state where cues aren't firing. If a track had to be at least 'hidden' to show in the menu, then all tracks would be firing all cues as you scrubbed along the timeline (even if they're not being displayed), and the performance of that would get pretty terrible. Hopefully it doesn't come to that.\r\n\r\n> > Ah this makes sense and now I see why you set track to disabled when switching from one to another in the menu.  Thanks for explanation.  \r\n\r\n> I could see a few other options...\r\n> The first and probably easiest would be to de-dupe languages in the captions menu, and just show the last one loaded.\r\n> > This would not work in the following case.  Source one has three lang text track in it,  source two only has two of the three previous source languages.  Resulting in a “rogue\" text track still being presented in source 2 that does nothing.\r\n\r\n> The second would be to have dash.js use a track element to add captions info, in which case it could be removed. Though I can't remember if you can modify the cues of a textTrack added via track element.\r\n\r\n> > Currently we are using the addTextTrack call on the video element.  Are you saying to manually create a TextTrackList, add textTrack(s) to that list then add List as child to video so that I can call removeChild later on? \r\n\r\n> Thirdly would be to figure out some mechanism for reusing cleared out tracks.\r\n\r\n> > So I already tried this but unfortunately you can not set the language property on a text track once added.  The only way to set the lang is as an arg of addTextTrack.   This was my first approach until I found that lang was only read not read/write\r\n\r\n...\r\n\r\n> > Maybe I can mark tracks that are “garbage” with some value and videojs could ignore ….  I am interested in the second option you purposed.  I am going to look at this as well.  \r\n\r\n...\r\n\r\n> > We have another use case that may cause more issues.   Fragmented Text tracks.     Currently with text tracks that externally load xml, we load all in MPD create a new textTrack per language, parse and add cues per lang and add the list to video element.  This way the player knows of all the lang choices.  But with fragmented text this is not the case.  We need to add API in dash.js to return a list of available language tracks to display in a given player’s menu.\r\n\r\n@gkatsev have you already figured this out? Otherwise can you add/remove cues from tracks that were created with track elements and vtt source files? That seems the most promising solution to me.\r\n\r\n(other people who may be able to add to this: @imbcmdth @OwenEdwards)"},"comment":{"url":"https://api.github.com/repos/videojs/video.js/issues/comments/122422617","html_url":"https://github.com/videojs/video.js/issues/2369#issuecomment-122422617","issue_url":"https://api.github.com/repos/videojs/video.js/issues/2369","id":122422617,"user":{"login":"gkatsev","id":535884,"avatar_url":"https://avatars.githubusercontent.com/u/535884?v=3","gravatar_id":"","url":"https://api.github.com/users/gkatsev","html_url":"https://github.com/gkatsev","followers_url":"https://api.github.com/users/gkatsev/followers","following_url":"https://api.github.com/users/gkatsev/following{/other_user}","gists_url":"https://api.github.com/users/gkatsev/gists{/gist_id}","starred_url":"https://api.github.com/users/gkatsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkatsev/subscriptions","organizations_url":"https://api.github.com/users/gkatsev/orgs","repos_url":"https://api.github.com/users/gkatsev/repos","events_url":"https://api.github.com/users/gkatsev/events{/privacy}","received_events_url":"https://api.github.com/users/gkatsev/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T21:27:59Z","updated_at":"2015-07-17T21:27:59Z","body":"These properties are always read-only on the TextTrack object. However, if this object is associated with a TextTrack HTML Element, these values could be changed through that element. I really do think the main reason for it is to have a purely programmatic interface.\r\n\r\nAlso, seems like `removeTextTrack` *did* exist at some point: https://codereview.chromium.org/92763002\r\nLooking into figuring out why it was removed."}}