jplayer 实现的歌词同步的时间点怎么获取
发布网友
发布时间:2022-05-15 12:53
我来回答
共1个回答
热心网友
时间:2023-10-24 05:42
我也遇到了这个问题。我的解决办法如下:
var myPlaylist;
$(document).ready(function () {
myPlaylist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_N",
cssSelectorAncestor: "#jp_container_N"
}, [
{
title: "春暖花开",
artist: "专辑1",
mp3: "mp3/春暖花开.mp3",
id:"35"
},
{
title: "领悟",
artist: "专辑2",
mp3: "mp3/领悟.mp3",
id:"34"
}
], {
playlistOptions: {
enableRemoveControls: true
},
swfPath: "js",
supplied: " mp3",
smoothPlayBar: true,
keyEnabled: true,
audioFullScreen: true
});
});
//输出id,用循环的方法查找当前的歌曲
function ShowId() {
var current = myPlaylist.current,
playlist = myPlaylist.playlist;
jQuery.each(playlist, function (index, obj) {
if (index == current) {
alert(obj.id);
} // if condition end
});
}
也希望能解决你的问题