字幕外 抱歉,这篇文章有英文版 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
|