josephrmoore / mp3player

An AJAX MP3 player to add to your site.
http://josephrogermoore.com
14 stars 7 forks source link

Add autoplay option? #4

Open Leinad4Mind opened 8 years ago

Leinad4Mind commented 8 years ago

How can I put this to work with autoplay?

When I go to the website the music doesnt play unless I click on play. How can I put this as autoplay?

josephrmoore commented 8 years ago

The player itself just uses HTML5 audio, so you should be able to easily add a line of JS somewhere (or possibly just in the markup, I can't remember if the player is dynamically added or not, I believe it is) to add the autoplay attribute to the player. In terms of being a feature, I'll think about it, see if there's a simple way for you (as the site host) can flip that on or off and maybe I'll do it in the next version.

Invictaz commented 8 years ago

Good thing, would like to have it too.

web-meff commented 7 years ago

I got it..but I'm not sure that this is the right solution... Open file 'mp3playerplugin.js' and add new boolean variable var autoplay with true value and scrolling to the bottom of file on +- 696 line, find rows.each(function(){

and after this put

 if(autoplay == true){
    player.loadSong(0);
}

where 0 is first track in your list or your custom variable