i got two buttons and i am using the code below but i’m not sure how to make changes,
/**
* Called when document is loaded.
*/
phoneui.documentReadyHandler = function() {
initAudio();
initAudio1();
}
//create a hidden <audio> element to play the src mp3 file;
//configure button click handler to toggle play on/off
function initAudio() {
audio = new Audio();
audio.src = ‘1.mp3’;
isPlaying = false;
buttonId = ‘#m1-custom-audio-demo2-playstop-btn’;
$(buttonId).click(toggleAudio);
//stop audio when changing browser page or click home btn
$(window).bind(‘pagehide’,stopAudio);
}
function toggleAudio() {
if (isPlaying) {
stopAudio();
} else {
playAudio();
}
}
//start playing, update button label to STOP
function playAudio() {
if (!audio || isPlaying) return;
audio.play();
isPlaying = true;
}
//start playing, update button label to PLAY
function stopAudio() {
if (!audio || !isPlaying) return;
audio.pause();
isPlaying = false;
}
}
{
//create a hidden <audio> element to play the src mp3 file;
//configure button click handler to toggle play on/off
function initAudio1() {
audio1 = new Audio1();
audio1.src = ‘2.mp3’;
isPlaying = false;
buttonId = ‘#m1-custom-audio-demo2-playstop1-btn’;
$(buttonId).click(toggleAudio1);
//stop audio when changing browser page or click home btn
$(window).bind(‘pagehide’,stopAudio1);
}
function toggleAudio1() {
if (isPlaying) {
stopAudio1();
} else {
playAudio1();
}
}
//start playing, update button label to STOP
function playAudio1() {
if (!audio1 || isPlaying) return;
audio1.play();
isPlaying = true;
}
//start playing, update button label to PLAY
function stopAudio1() {
if (!audio1 || !isPlaying) return;
audio1.pause();
isPlaying = false;
}