如何用cookie记住标题语言?

时间:2018-04-26 21:26:42

标签: php mysql html5 html5-video closed-captions

我正在使用php和mysql来设置字幕,如果它们存在于数据库中。 如果它们不存在,它将不会出现在播放器中。

我希望有一种cookie可以记住访问者选择的语言,并默认为未来的视频启用标题。 现在我在荷兰语字幕上有'default =“true”'。 (如果可能的话,备份语言。)

<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>

0 个答案:

没有答案