有一个HTML播放列表,我想在用户点击播放列表中的某个项目时更改当前的视频和图片,但它无效。我的代码出了什么问题?
我的HTML:
<div class="item-video">
<script>
var playerData = {
file: 'dummy-file.flv',
image: 'dummy-image.jpg',
autostart: false
}
</script>
<div id="item-player"></div>
<div class="playlist">
<ul>
<li>
<a class="thumb-holder" href="#" data-video="new-video.flv" data-image="new-image.jpg" title="test">
<img src="" alt="" />
<span>test</span>
</a>
</li>
</ul>
</div>
</div>
JavaScript代码:
if ($(".item-video").length) {
if (typeof playerData != 'undefined') {
jwplayer('item-player').setup({
file: playerData.file,
image: playerData.image,
height: '300',
width: '420',
stretching: 'uniform',
smoothing: 'false',
modes: [
{ 'type': 'html5' },
{ 'type': 'flash', src: '/mediaplayer/player.swf' },
{ 'type': 'download' }
],
autostart: playerData.autostart,
backcolor: '#efefef',
controlbar: 'bottom',
skin: '/mediaplayer/skins/bekle/bekle.zip',
allowscriptaccess: 'always',
});
}
$(".playlist").delegate('a', 'click', function(e) {
var $item = $(this);
var video = $item.attr('data-video');
var image = $item.attr('data-image');
if (typeof video != 'undefined') {
jwplayer().load({
file: video,
image: (typeof image != 'undefined') ? image : ""
});
}
e.preventDefault();
});
}
似乎JWPlayer家伙已经删除了JWPlayer 5的文档,他们建议升级到JWPlayer 6,但我不能!