Hi all
I have a media clip with three caption tracks and i need to switch between them from outside of the player using javascript, can this be done?
I have tried setting and resetting the closedCaptions_languageKey cookie, and have poked about in the “kdp” player code related to showClosedCaptions and hideClosedCaptions sendNotification methods without success…
I’ve even tried targeting the menu items with code such as:
`$("iframe", "#kaltura_player1").contents().find(".closedCaptions li a:contains(English)").click()`
even though i know it’s “wrong” (but it doesn’t work)
Any clues?
TIA
jonny
Hi,
If you need to define the selected language using Javascript before the player loads, simply set the “defaultLanguageKey” Flashvar of the closedCaptions plugin to the selected language.
Currently you can’t change the captions language at runtime using Javascript, only via the closed captions UI.
Many thanks for the speedy reply Amir, i suppose that’s what i was expecting
So i wonder if there’s a more “Kaltura” way of achieving what we need… which is:
We need a transcript to appear along side the video highlighting where we are in the script (which i have working), plus a “slide show” presentation showing pages synced with the video (which works if i pick the pretend “slideshow” language caption track and then to top things off a different language showing as “standard” captions (so if the user is set to English, Chinese subtitles are shown and vice versa, which i also have working but only if i pick the track manually.
Did i miss something in Kaltura somewhere that i could use to get this working? I hope so, as i’m a bit stumped now!
I did initially try using popcorn.js but it seemed like such a struggle to get Kaltura to work with it we decided against it… hope someone can think of a way round this…
Hi @jonny_11,
First, the API you need sounds like a valid request and I will try to add it to our next player version.
For now, the only option you have is to use the “wrong” option which is using jQuery to find the required li link and trigger click event on it. You almost got it right in your code.
I’ve created a Plunkr for you showing how to do that - simply click the “Spanish” button below the player to switch to Spanish captions. Here is the link: https://plnkr.co/edit/rVPbwmOlJG3fdKskkazU?p=preview Please let me know if this works for you.
Amir
1 Like
Wow, thank you so much Amir,
I didn’t think of that get(0) bit as usually the click trigger works on all objects in the jq array, so many many thanks for that, got me out of a big hole!
Now i just have to work out which other bit of my code is locking up the browser now that my “slides” track is kicking in!