Topic: random music

in audio I have 10 .Ogg files, named 1 to 10. I want a random song selected each time the slideshow is loaded. How can this be done?

Re: random music

This is not possible using Juicebox-Pro alone. Juicebox-Pro supports only a single audio track which can be started and stopped using the Audio Button on the Button Bar.
You would need to find to find a third party audio player (which can be controlled via JavaScript), listen for the Juicebox-Pro API event onImageChange(id) to be fired (which happens each time the main image in the gallery is changed) and use this to trigger a random audio track to be played by the third party audio player.

Re: random music

That shouldn't make any difference if there ia an xml random statement that decides which file is loaded. I just don,t know how to write it. There needs to be a routine that randomly selects the song url to pass to the audio url line. I can do a flash routine but i want it to work on ipads,

Re: random music

Sorry. I misunderstood your query.
You could generate a random number using JavaScript and set the audioUrlMp3 and audioUrlOgg configuration options in your gallery's embedding code instead of in the XML file.
For example, you could name your audio files 'track1.mp3' and 'track1.ogg', 'track2.mp3' and 'track2.ogg' up to 'track10.mp3' and 'track10.ogg' and then use the following code:

<!--START JUICEBOX EMBED-->
<script src="jbcore/juicebox.js"></script>
<script>
    var rnd = Math.floor((Math.random()*10)+1);
    var mp3 = 'track' + rnd + '.mp3';
    var ogg = 'track' + rnd + '.ogg';
    new juicebox({
        containerId: 'juicebox-container',
        audioUrlMp3: mp3,
        audioUrlOgg: ogg
    });
</script>
<div id="juicebox-container"></div>
<!--END JUICEBOX EMBED-->

Re: random music

Where do I put the code? at the top of the config.xml file?

Re: random music

Where do I put the code?

Just replace your gallery's current embedding code in the 'index.html' file (or whatever HTML file you have embedded your gallery in) with the code above (and rename your audio files as I noted above and place them in your gallery folder alongside the HTML file).

at the top of the config.xml file?

The only modification you should make to the XML file is to remove the audioUrlMp3 and audioUrlOgg entries as they are now being set (randomly) in the embedding code.

Re: random music

Thank you, it works great.