有一个 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,但我不能!