1

I'm trying to implement jPlayer to stream some channels from SHOUTcast. EVerything fine and well till the "now playing" part.

See here the testing area: http://www.powermixfmradio.com/2013/index.php

The idea is, every time someone clicks on a channel, the "Now Live on the xxxxxx Channel:" should change according to the selected channel, but I have no idea how to do that. I made in PHP a simple script that reads the current song on each channel and assigned them to $trance, $house (etc). For the example, it's using <?php echo "$trance"; ?> to display the data, but how can I make that change every time the channel changes (change <?php echo "$trance"; ?> to <?php echo "$house"; ?> and so on)?

The developer of jPlayer was nice enough to guide me in a way and gave me a start:

select: function(index) {
        index = (index < 0) ? this.original.length + index : index; // Negative index relates to end of array.
        if(0 <= index && index < this.playlist.length) {
            this.current = index;
            this._highlight(index);
            $(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
            // Add stuff here.
        } else {
            this.current = 0;
        }
    },

But since my jq knowledge is pretty limited, I have no idea what to add or edit there. Can you help?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
uvot media
  • 11
  • 2

0 Answers0