问题描述
当前,我正在从事Codeigniter项目,因为我需要将Jw Player 5与播放列表集成在一起.我刚刚创建了一个动态的plalist,并且工作正常.因此,现在我想获取当前播放视频的标题或其他一些详细信息.我尝试了很多,但是没有运气.我刚刚在这里发布了一些JavaScript代码,这些代码是从Jw Player网站论坛上获得的,但对我来说不起作用.我只是尝试静态的.这是代码..
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..
推荐答案
<div id="nowplaying">
<script type="text/javascript">
var current = jwplayer().getPlaylistItem();
console.log(current.title);
</script>
</div>
这篇关于获取当前播放的视频的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!