ttwMusicPlayer unable to call twice in a same page

313 views Asked by At

I am using this plugin for my music player.
http://www.codebasehero.com/2011/06/html-music-player/

It work great if I have a single music player on page. However, I am unable to call it twice. No errors is show on my chrome console.

      $('#musicPlayList_1').ttwMusicPlayer(myPlaylist, {
         autoPlay: true,
         description: '',
         jPlayer: {
         swfPath: '../Sites/Plugins/jquery-jplayer'
      }});

      $('#musicPlayList_2').ttwMusicPlayer(myPlaylist2, {
         autoPlay: true,
         description: '',
         jPlayer: {
         swfPath: '../Sites/Plugins/jquery-jplayer'
      }});

After google, someone also faced the same issues but no solution was found. http://www.expressmedianews.com/multiple-ttw-music-player-players-on-page/

1

There are 1 answers

0
RumelDilDumpel On

Basically ttwMusicPlayer can't be called more than once because it's of its calling of classes and ids:

    cssSelector = {
        jPlayer: "#jquery_jplayer",
        jPlayerInterface: '.jp-interface',
        playerPrevious: ".jp-interface .jp-previous",
        ratingLevel:'.rating-level',
        ratingLevelOn:'.on',
        ...
        ...

    };

or

        function setDescription() {
            if (!isUndefined(options.description))
                $self.find(cssSelector.description).html(options.description).addClass(attr(cssSelector.descriptionShowing)).slideDown();
        }

You can edit such lines to make it work (But this probably could take a while).