Get title of currently playing video

旧城冷巷雨未停 提交于 2019-12-11 21:45:45

问题


Current I am working in codeigniter project, in that I need to integrate Jw player 5 with playlist. I just created plalist which are dynamic and its working fine. So, now I want get title or some other details of currently playing videos. I tried a lot, but no luck. I just posted here a bit of javascript code, I get that from Jw player sites forum, but it is not working for me. I just tried by static. Here is the code ..

<!DOCTYPE HTML>
<html>

        <div id="mediaplayer">
    </div>

    <script type="text/javascript" src="http://172.16.1.181:85/test/player1/jwplayer.js"></script>


            <script type="text/javascript">
                    jwplayer("mediaplayer").setup({
            flashplayer: "http://172.16.1.181:85/test/player1/player.swf",
                    height:"350",
                    width:"500",
                    autostart: "true",
                    'playlist': [{
            'file': 'http://172.16.1.181:85/test/flash/test.flv',
                    'image': 'http://172.16.1.181:85/test/images/no_image.gif',
                    'title': 'Test_video_1'
            },
            {
                'file': 'http://172.16.1.181:85/test/flash/test.flv',
                        'image': 'http://172.16.1.181:85/test/images/no_image.gif',
                        'title': 'Test_video_2'
                }
            ],
                    repeat: 'list'
            });

        </script>



<p>In the body:</p>
      <div id="nowplaying">

      <script type="text/javascript">
      jwplayer().getPlaylistItem().index
      </script>
      </div>


</html>

The player playing the video well. But I Dont know how to get currently playing video's details..Please help me guys..


回答1:


 <div id="nowplaying">
    <script type="text/javascript">
       var current = jwplayer().getPlaylistItem();
       console.log(current.title);
    </script>
</div>


来源:https://stackoverflow.com/questions/19999796/get-title-of-currently-playing-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!