Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Using Index Number to Highlight Currently Playing Song

1 reply [Last post]
Reply

I'm trying to use the index number in the playlist to highlight the currently playing song on a page. Here is my JS:

function itemMonitorPlaying(obj)
      {
        var current_song = 'song'+player.getPlaylistItem().index;
       
        if (gid(current_song) == current_song) {
        document.getElementById('song'+player.getPlaylistItem().index).style.backgroundColor="#cccccc";
        }
       
      };

And here is my PHP:

<tr id="song<? echo ($i + 0); ?>" class="lined sectiontableentry<? echo $k; ?>" >

I'm not sure what I'm doing wrong but I sure would appreciate some help.

Nick

Reply

index is not a property of the object returned by getPlaylistItem().
Capture the event:

    jwplayer().onPlaylistItem(function(event) {
        var current_song = 'song'+event.index;
        .....
    })

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options