我正在尝试触发JW Player显示当前项目(正在播放)。不幸的是,我不能让它工作。获取错误:
[Error]TypeError:undefined不是对象(评估"G.length")
这是我的代码:
<head>
<style type="text/css">
body {
background-color: #000;
}
.jwrapbuttons {
max-width: 330px;
margin: 0 auto;
}
.jwbutton {
font-weight: bold;
font-size: 26px;
padding: 10px 30px;
border: 2px solid #ff0000;
color: #ff0000;
display: inline-block;
text-decoration: none;
margin: 50px 10px;
background: rgba(255, 0, 0, 0.3);
}
.videobgelement {
position: fixed !important;
z-index: -1;
top: 0;
left: 0;
}
</style>
</head>
<script src="jwplayer/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="m7vmXLZ0enrVLb+YYgi5ov3fLyu1cuUO06mN3bduBFQsvJceYFThIWkoGOmfvZPm";</script>
<div id="player"></div>
<script type="text/javascript">
jwplayer('player').setup({
width: "100%",
height: "100%",
playlist: "playlist.jw5.rss",
plugins: {
'../jwplayer.shuffle.js': {
autostart: true,
repeatplaylist: true,
shuffle: true
}
}
});
jwplayer('player').addButton("shuffle.png", "Shuffle", function() {
shuffle_setShuffle();
}, "jwplayer-shuffle");
jwplayer('player').addButton("repeat.png", "Repeat", function() {
shuffle_setRepeatPlaylist();
}, "jwplayer-repeat");
var current = jwplayer().getPlaylistItem();
console.log(current);
</script>
</script>
</div>
我知道这有点乱,但我想知道:我哪里错了?我应该定义什么才能起作用?
Riccardo
修复了它:触发警报而不是随机触发。此外:旧版本的JW Player不支持getPlaylistItem。它在6.5及以上版本中得到支持。