Ios Cordova App Crashes while playing audio -
i creating game in cordova. crashes while playing audio. need play 1 sound background music , other 1 game sound(on button click audio). implemented below code crashes in ipad
<audio id="musicsound" src="audio/music.mp3" type="audio/mp3" ></audio> <audio id="joinsound" src="audio/join.mp3" type="audio/mp3" ></audio> playaudio('musicsound'); function playaudio(id) { var audioelement = document.getelementbyid(id); var url = audioelement.getattribute('src'); mediaflag = "true"; my_media = new media(url, // success callback function () { console.log("playaudio():audio success"); }, // error callback function (err) { console.log("playaudio():audio error: " + err); } ); // play audio my_media.play(); } function pauseaudio() { if (my_media) { my_media.pause(); } } function stopaudio() { mediaflag = "false"; if (my_media) { my_media.stop(); // my_media.release(); } }
Comments
Post a Comment