Unfortunately, there are no startAudio() and stopAudio() methods in the Juicebox-Pro API, just toggleAudio().
Also, there is no Juicebox-Pro API event which is fired when the audio is toggled so that you can keep track of whether the audio is playing or not.
However, you could check the 'title' attribute of the Audio Button (which, unless you change the languageList, will be 'Play Audio' when the audio is paused and 'Pause Audio' when the audio is playing) and then use the Juicebox-Pro API method toggleAudio() to stop the audio only if the 'title' attribute is 'Pause Audio'.
To see an example of this in action, create a sample gallery in JuiceboxBuilder-Pro and use the following code as the gallery's 'index.html' file (changing the audio URLs as appropriate). Click the 'Stop Audio' button to stop the audio.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" id="jb-viewport" content="minimal-ui" />
<style type="text/css">
body {
margin: 0px;
}
</style>
<script type="text/javascript" src="jbcore/juicebox.js"></script>
<script type="text/javascript">
var jb = new juicebox({
audioUrlMp3: "music.mp3",
audioUrlOgg: "music.ogg",
containerId: "juicebox-container",
galleryHeight: "400",
galleryWidth: "600",
showAudioButton: "TRUE"
});
$(document).ready(function() {
$('#stop').click(function() {
var title = $('.jb-bb-btn-audio').first().attr('title');
if (title === 'Pause Audio') {
jb.toggleAudio();
}
});
});
</script>
<title>Test</title>
</head>
<body>
<div id="input">
<input id="stop" type="button" value="Stop Audio" />
</div>
<div id="juicebox-container"></div>
</body>
</html>
Please note that my suggestion above uses jQuery. Juicebox comes with its own bundled version of jQuery (within the 'juicebox.js' file) so basic jQuery functionality is available as soon as the 'juicebox.js' file is loaded in the page (and without the need to explicitly include a separate jQuery JavaScript file).
However, if your web page uses any jQuery code at all, I would recommend including a separate jQuery JavaScript file (just in case we remove any jQuery functionality from the 'juicebox.js' file in the future).