Answered by:
Remove Closed Captions?

Question
-
How can I remove the closed captions after I've already added the closed captions?
I use my player to play a number of videos. For example, Video #1 has closed captions so I add the closed captions like this:
var sSubURL;//URL to closed captions
myPlayer.tracks = [{ kind: 'captions', srclang: 'en', src: sSubURL, label: "English captions" }];
Video #1 then ends and Video #2 begins. Video #2 doesn't have closed captions, so I tell the player to delete the previous closed captions like so:
myPlayer.tracks = [];
However, the closed captions button is still enabled and when I click the closed captions button, it still displays the "English captions" label from the previous Video#1 closed captions.
Because the 2nd video in this instance doesn't have closed captions, I can simply disable the feature like so:
myPlayer.isCaptionsEnabled = false;
However, if the 2nd video had a different set of closed captions, I want to be sure I can change the closed captions on the fly.
What am I doing wrong?p.s. I posted this question on the player framework forum, but I am unsure which is the best place to post to regarding this topic.
Thanks!
Saturday, August 16, 2014 2:47 AM
Answers
-
I figured out the answer!
To get rid of the closed captioning I had to use the following line:
myPlayer.captionTracks= null;
If I want to then add a dfferent set of closed captioning to the video player then I once again use the following code which I had mentioned in my original code:
var sNewSubURL;//URL to closed captions
myPlayer.tracks = [{ kind: 'captions', srclang: 'en', src: sNewSubURL, label: "English captions" }];Before I had set the "captionTracks" property to null, I also tried to set the "tracks" property to null; however, doing so doesn't do anything. Only setting "captionTracks" property to null actually clears the previous closed captioning.
To me this seems like a bug. If I set the "tracks" property, but never set the "captionTracks" property, then I would expect to only have to reset the closed captioning by calling the "tracks" property.
- Marked as answer by Jaxim Monday, September 22, 2014 2:19 PM
Monday, September 22, 2014 2:19 PM
All replies
-
Hi Jaxim,
Suggestions will by provided by regarding it as a control in this forum. If you ask something specific for instance how to use the parameters in the control then the player framework forum is a good place.
I would say, would you like try to remove the control (myPlayer) totally from Windows Store App HTML page and then add a new one by assigning it 2nd video source and set a new Closed Caption URL for it.
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
- Edited by Jamles HezModerator Monday, August 18, 2014 2:57 AM
Monday, August 18, 2014 2:56 AMModerator -
I would like to avoid removing the player and creating a new one. It would seem like there should be a way to do this with the current player. I can do this with the VideoJS player, so I imagine there is a way to do this with the Player Framework player. Unfortunately, I have found very little documentation on the Framework player regarding this topic.
thanks!
Monday, August 18, 2014 3:33 AM -
Hi Jaxim,
Ok, maybe ask at this place https://playerframework.codeplex.com/discussions could be a better choice, since you are questioning for a feature of this control.
Simply search on the documentation: https://playerframework.codeplex.com/wikipage?title=JavaScript%20API%20Reference. I did find something useful properties and methods:
captionTracks (type: Array, read/write)
Gets the caption and subtitle tracks for the current media source.load()
retry()
Reloads the current media source..
Reloads the current media source and resumes where playback was left off.
update(mediaSource)
Updates the player and its plugins with the specified media source (e.g. the current playlist item).mediaSource: (type: Object) A JSON object containing the set of options that represent a media source.
Give a try and to see if it works.
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- Marked as answer by Jamles HezModerator Friday, September 5, 2014 9:54 AM
- Unmarked as answer by Jaxim Monday, September 22, 2014 2:11 PM
Tuesday, August 26, 2014 5:28 AMModerator -
I figured out the answer!
To get rid of the closed captioning I had to use the following line:
myPlayer.captionTracks= null;
If I want to then add a dfferent set of closed captioning to the video player then I once again use the following code which I had mentioned in my original code:
var sNewSubURL;//URL to closed captions
myPlayer.tracks = [{ kind: 'captions', srclang: 'en', src: sNewSubURL, label: "English captions" }];Before I had set the "captionTracks" property to null, I also tried to set the "tracks" property to null; however, doing so doesn't do anything. Only setting "captionTracks" property to null actually clears the previous closed captioning.
To me this seems like a bug. If I set the "tracks" property, but never set the "captionTracks" property, then I would expect to only have to reset the closed captioning by calling the "tracks" property.
- Marked as answer by Jaxim Monday, September 22, 2014 2:19 PM
Monday, September 22, 2014 2:19 PM