我想在jplayer中获取当前播放的电影数量。
例如在播放列表中我收到了3部电影,当我们说第二部电影播放时,就会发生一些事情。
我从文档中找到的所有内容都是:
var myPlaylist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
{
title: "Big Buck Bunny Trailer",
artist: "Blender Foundation",
free: true,
m4v: "http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v"
},
{
title: "Finding Nemo Teaser",
artist: "Pixar",
m4v: "http://www.jplayer.org/video/m4v/Finding_Nemo_Teaser.m4v"
},
{
title: "Incredibles Teaser",
artist: "Pixar",
m4v: "http://www.jplayer.org/video/m4v/Incredibles_Teaser.m4v"
}
], {
swfPath: "js",
supplied: "m4v",
smoothPlayBar: true,
keyEnabled: true
}
); 然后
if(myPlaylist.play()=="0"){
console.log("do something")
}
或
if(myPlaylist.play(0)){
console.log("do something")
}
根本不起作用。如果有人能帮助我,那就太棒了:)。
答案 0 :(得分:0)
我在这里找到了你的问题
jPlayer 2.2.0: display track title in separate div on page load
$("#jquery_jplayer_1").bind($.jPlayer.event.play, function(event) {
var current = myPlaylist.current,
playlist = myPlaylist.playlist;
$.each(playlist, function(index, obj) {
if (index == current) {
console.log(current)
}
});
});