javascript - Phonegap on android - will only play mp3 when button clicked, but not through a function -



javascript - Phonegap on android - will only play mp3 when button clicked, but not through a function -

i'm using phonegap, , works beautifully in browser.

i have various buttons play mp3 sounds , work fine, on browser , android.

i have few sounds called functions, when timer runs out. these play in browser, don't play when i'm testing app on android device via phonegap desktop program.

it isn't sound files play when button clicked no sounds play on function. here code.

index.html -

<audio src = "sounds/beginjingle.mp3" id="begin-jingle" preload = "auto" type="audio/mpeg"></audio> <audio src = "sounds/donebell.mp3" id="done-bell" preload = "auto" type="audio/mpeg"></audio>

javascript.js

//audio function - plays sound function playsound(sound){ document.getelementbyid(sound).currenttime = 0; document.getelementbyid(sound).play(); }

this counter, phone call function when time has run out, , below function, playsound function @ top -

//game counter var mycounter = new countdown({ seconds:13, // number of seconds count downwards onupdatestatus: function(sec){$("#timer").text("time: " + sec);}, // callback each sec oncounterend: function(){ turnover(); } // final action }); //when turn on function turnover(){ playsound("done-bell"); hideeverything(); var currentteam = getcurrentteam(); $("#turn-complete").show(); $(".back-to-menu-btn").show(); $("#turn-score").text("this turn score: " + currentteam.getturnscore()); $("#total-score").text("your total score: " + currentteam.getscore()); currentteam.turncomplete = true; currentteam.resetcurrentturnscore(); }

this works -

$("#incorrect").click(function(){

//show old word or new word if(variablerulecheck()){ displayoldword(); } else{ displaynewword(); } //play sound playsound("incorrectsound"); //increase score var currentteam = getcurrentteam(); currentteam.changescore(-10); });

i'm struggling doesn't seem create sense sounds play fine, , other code within functions execute.

does have ideas going on? i'm assuming/hoping i've made silly mistake??

thanks!

darrell

javascript android cordova mp3

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -