jplayer存在问题,我需要做的是,我想在上一首曲目结束后自动播放下一首曲目。 我的HTML为:
<div class="row-track active" data-track-id="30">
<div class="row-holder" data-src="url/30">
<span class="status">
<a href="javascript:;" data-toggle="tooltip" title="" class="play-pause no-pjax addTrack audio-element" data-audio="mp3_url" data-waveform="img_url" data-id="30" data-album-id="74" data-title="Usually Suspect" data-artist="Ambient Drama" data-original-title="#7">play/pause
</a>
</span>
</div>
</div>
<div class="row-track active" data-track-id="40">
<div class="row-holder" data-src="url/40">
<span class="status">
<a href="javascript:;" data-toggle="tooltip" title="" class="play-pause no-pjax addTrack audio-element" data-audio="mp3_url" data-waveform="img_url" data-id="40" data-album-id="74" data-title="Usually Suspect" data-artist="Ambient Drama" data-original-title="#7">play/pause
</a>
</span>
</div>
</div>
在jplayer中-> bind($.jPlayer.event.ended
我已经完成了:
var nextSongId = $("div[data-track-id='"+event.jPlayer.status.media.trackId+"']").
next().attr('data-track-id');
var trackOnEnd = inPlaylist(nextSongId);
demo.play(trackOnEnd);
in demo.playlist I have an array of object.
inPlaylist function is as follows:
function inPlaylist(id) {
var state = null;
$.map(demo.playlist, function(elementOfArray, indexInArray) {
if(elementOfArray.trackId == id) {
state = indexInArray
}
});
return state
};
其中状态仅是对象在对象数组中的索引。 在某些地方,它工作正常。但是在某些情况下,它给我一个错误
无法读取未定义的属性“海报”