JWPlayer正在播放

时间:2015-02-07 22:23:22

标签: javascript jwplayer

我试图触发JW Player显示当前项目(正在播放)。不幸的是,我无法让它发挥作用。得到错误:

  

[错误] 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

1 个答案:

答案 0 :(得分:1)

修正了它:发出警报而不是随机发出警报。另外:旧版本的JW Player不支持getPlaylistItem。 6.5及以上版本支持它。