- Forum posts: 7
Feb 2, 2012, 11:16:43 PM via Website
Feb 2, 2012 11:16:43 PM via Website
I'm still fairly new to Android development, so I'm just looking for some direction. I downloaded a logcat viewer, found where the mp3 files are being loaded up, but nothing stands out as an error or problem. Here's the basic JS code that should play the sound.
var sounds = new Array();
sounds[0] = "0.mp3";
sounds[1] = "1.mp3";
sounds[2] = "2.mp3";
sounds[3] = "3.mp3";
function PlaySound() {
randNum = Math.floor(Math.random()*4);
var sound = new Audio(sounds[randNum]);
sound.play();
}
The PlaySound function is called when the button is tapped. I've done console logs to ensure the function is called properly.
Not sure the best method to go about debugging this. Any help would be great.
Thanks,
Justin
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.