字幕外

  抱歉,此页面正在等待翻译成土耳其语

You can put subtitles in an external container if you want to display them outside of the player. Just enable catching API events and catch the subtitles event, then throw the subtitle container outside. The player assigns the pjs_playerID_subtitle id to the subtitle container (playerID is the id of the player).

<div id="player1"></div>
<div id="subtitle_container"></div>
<script>
   var player = new Playerjs({id:"player1", file:URL, subtitle:[En]URL,[Es]URL});
   function PlayerEvents(event,id,info){
      if(event=="subtitles"){
         document.getElementById("subtitle_container").appendChild( document.getElementById("pjs_player1_subtitle") );
      }
   }
</script>

Important points

  • Such subtitles need to be assigned a static position in CSS. For the example above it looks like this #pjs_player1_subtitle{position:static!important;top:auto;left:auto;}
  • Subtitles will no longer be displayed in full screen mode. You can do the reverse operation if you need to return them back.
  • You need to set the bottom padding value for the subtitles to be greater than the height of the control bar so that they don't move with it.
  • Subtitle options (colors, sizes, etc.) will continue to work after outside moving (can be disabled in plugin settings).
  • It works from version 18.4

19.12.10
2024 © PlayerJS

登录

登录

免费注册

注册
注册即表示您同意服务条款
登录(如果您有帐户)

恢复密码

恢复
忘记电子邮件?联系我们