Closed Captions

Captions selection logic

 1. Check if there is an existing cookie (created by the player),
which remembers a language preferred by the user.
if user selected specific caption, it is saved in a cookie,
and the next time that he reloads the page, that cookie will be checked and preferred. 2. If there was no existing cookie, check if default caption is set for the entry via the
KMC, or FlashVar (defaultLanguageKey), if there is, use it.
on iOS devices defaultLanguageKey takes effect only if the user device is set to
auto(Recommended), otherwise the caption selected by the user is used. 3. If cases 1 or 2, did not occur, check for user's browser language and,
select the relevant caption. 4. If none of the above occurred, select the first available caption.

Captions API

The Kaltura captions API enables you to hide and show captions via javascript.
Show Captions
kdp.sendNotification( 'showClosedCaptions' );
Hide Captions
kdp.sendNotification( 'hideClosedCaptions' );
Toggle Captions
kdp.sendNotification( 'showHideClosedCaptions');
Change media to entry without captions -- will hide button if hideWhenEmpty is set to true
Change media to entry with captions -- will restore caption button if hidden.

Log caption events:

kdp.kBind('ccDataLoaded', function(){
$('#log').append( "ccDataLoaded -- All captions has been loaded<br>" );
kdp.kBind('newClosedCaptionsData', function(){
$('#log').append( "newClosedCaptionsData -- A caption asset had been loaded<br>");
kdp.kBind('changedClosedCaptions', function(event){
$('#log').append( "ccChanged -- Caption asset has been changed, selected language is: " + event.language + "<br>");
kdp.kBind('closedCaptionsHidden', function(){
$('#log').append( "ccHidden -- Caption asset is hidden<br>");
kdp.kBind('ccDisplayed', function(event){
$('#log').append( "ccDisplayed -- Caption asset is displayed, selected language is: " + event.language + "<br>");
Event Log: