Riccardo de Wit
Riccardo de Wit

Reputation: 45

JWPlayer Now Playing

I'm trying to trigger JW Player to display the current item (now playing). Unfortunately I can't get it to work. Getting an error:

[Error] TypeError: undefined is not an object (evaluating 'G.length')

This is my code:

        <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>

I know it is a bit messy, but I'm wondering: where did I go wrong? What should I define so it'll work?

Riccardo

Upvotes: 2

Views: 448

Answers (1)

Riccardo de Wit
Riccardo de Wit

Reputation: 45

Fixed it: firing an alert instead of just randomly. Also: getPlaylistItem is not supported in old versions of JW Player. It's supported in 6.5 and above.

Upvotes: 1

Related Questions