SoundManager2 bar-ui audio playlist

** EDITED **

See Jon Black answer below as the right solution ...

I am trying to use SoundManager2 HTML5 Audio Player on a website for a client, however, the client insists that the .mp3 playlist play automatically starting from track 1 and cycling the rest of the track.

The original script (soundmanager2.js on the site) has an autoPlay: false parameter, but changing it to true does nothing.

Here is a link to the demo website that I created using SoundManager2 bar-ui (which is the type the client wants to use) and a script to autoplay the .mp3 track in the background: with a working demo

As you can see (and hear), the background sound is automatically played, but NOT through the soundbar, as expected. If you click โ€œPlayโ€ or click on a playlist item in the track menu, the sound that you just clicked just plays the background sound, which is undesirable. I need an audi playlist for auto play with the ability to play, pause and select various tracks through the subwoofer.

Here is a link to the SoundManager2 project source site for further information .

I hope someone can tell me how to create a function or provide a script that will allow the playlist to automatically play the user interface of the audio player when the page loads.

TON , ! , .

!

+4
5

. init() line 1378 bar-ui.js.

    soundObject = makeSound(playlistController.getURL());
    soundObject.togglePause();

init() , ( makeSound(playlistController.getURL()), ( togglePause()).

+1

. , . Chrome

sound0: play(): Loading - attempting to play...
bar-ui.js:125 Uncaught TypeError: Cannot read property 'on' of undefined

, autoPlay .

Object {url: "http://freshly-ground.com/data/audio/sm2/SonReal%20-%20LA%20%28Prod%20Chin%20Injetti%29.mp3", volume: 100, autoLoad: false, autoPlay: true, from: nullโ€ฆ}
+2

Jon: , bar-ui.js, soundManager.setup

onready: function() {
makeSound(playlistController.getURL());
togglePause();
}

, .

0

Oj Obasi, Jon Black, init() . , :

init(); // the init call

    exports = {
      // Per-instance events: window.sm2BarPlayers[0].on = { ... } etc. See global players.on example above for reference.
      on: null,
      actions: actions,
      dom: dom,
      playlistController: playlistController
    };
    soundObject = makeSound(playlistController.getURL()); // these two lines make it autoplays the playlist from beginning
    soundObject.togglePause(); // these two lines make it autoplays the playlist from beginning
    return exports;
Hide result
0

SM2- ( ) :

sm2BarPlayers[0].actions.play();
0

All Articles