This project is read-only.

Remove Closed Captions?

Topics: Windows 8 JavaScript, Windows Phone 8
Aug 15, 2014 at 5:01 PM
Edited Aug 15, 2014 at 5:06 PM
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?
Sep 22, 2014 at 3:21 PM
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 on 9/22/2014 at 7:21 AM