I'm using php with mysql to set subtitles if they exist in the database. If they don't exist it will not show up in the player.
I want to have some kind of cookie that remembers the language the visitor have selected and enable the caption by default for future video's. Right now i have 'default="true"' on the Dutch subtitle. (If possible a backup language.)
<div class=" embed-responsive-16by9 player">
<video id="video" class="video-js vjs-default-skin player-self" poster="<?php printf ("%s",$episode[thumbnail]); ?>" controls preload="metadata">
<source src="<?php printf ("%s",$episode[file]); ?>#track=fre&track=ger&track=jpn" type="video/mp4">
<?php if(empty($episode['sub_eng'])){}else{?><track src="<?php printf ("%s",$episode['sub_eng']); ?>" kind="subtitles" srclang="en" label="English"><?php }?>
<?php if(empty($episode['sub_eng_sign'])){}else{?><track src="<?php printf ("%s",$episode['sub_eng_sign']); ?>" kind="subtitles" srclang="en" label="English Signs and Songs"><?php }?>
<?php if(empty($episode['sub_eng_sdh'])){}else{?><track src="<?php printf ("%s",$episode['sub_eng_sdh']); ?>" kind="subtitles" srclang="en" label="English SDH"><?php }?>
<?php if(empty($episode['sub_dut'])){}else{?><track src="<?php printf ("%s",$episode['sub_dut']); ?>" kind="subtitles" srclang="nl" label="Dutch" default="true"><?php }?>
<?php if(empty($episode['sub_dut_sign'])){}else{?><track src="<?php printf ("%s",$episode['sub_dut_sign']); ?>" kind="subtitles" srclang="nl" label="Dutch Signs and songs"><?php }?>
<?php if(empty($episode['sub_fin'])){}else{?><track src="<?php printf ("%s",$episode['sub_fin']); ?>" kind="subtitles" srclang="fi" label="Finnish"><?php }?>
<?php if(empty($episode['sub_fre'])){}else{?><track src="<?php printf ("%s",$episode['sub_fre']); ?>" kind="subtitles" srclang="fr" label="French"><?php }?>
<?php if(empty($episode['sub_ger'])){}else{?><track src="<?php printf ("%s",$episode['sub_ger']); ?>" kind="subtitles" srclang="de" label="German"><?php }?>
<?php if(empty($episode['sub_ita'])){}else{?><track src="<?php printf ("%s",$episode['sub_ita']); ?>" kind="subtitles" srclang="it" label="Itaian"><?php }?>
<?php if(empty($episode['sub_nor'])){}else{?><track src="<?php printf ("%s",$episode['sub_nor']); ?>" kind="subtitles" srclang="it" label="Norwegian"><?php }?>
<?php if(empty($episode['sub_por'])){}else{?><track src="<?php printf ("%s",$episode['sub_por']); ?>" kind="subtitles" srclang="it" label="Portuguese"><?php }?>
<?php if(empty($episode['sub_spa'])){}else{?><track src="<?php printf ("%s",$episode['sub_spa']); ?>" kind="subtitles" srclang="es" label="Spanish"><?php }?>
<?php if(empty($episode['sub_swe'])){}else{?><track src="<?php printf ("%s",$episode['sub_swe']); ?>" kind="subtitles" srclang="it" label="Swedish"><?php }?>
</video>
<script async crossorigin="anonymous" src="//player.h-cdn.com/loader.js?customer=hc_9b69e6d6"></script>
<script>
window.hola_player({
player: '#video',
});
</script>
</div>