javascript - Audio on Chrome for mobile isn't working using Jquery -
i tried play sound (wav, ogg) using html5 javascript on chrome mobile, it's not working. tried "fake" click, nothing happened.
$(document).on("click", "#audio", function(){ var = $('#audio'); if(a.length !== 0){ a.get(0).play(); } }); $('#audio').click();
or
var audio = new audio("file.ogg"); audio.play();
html
<audio controls="controls" id="audio" class="hidden"> <source src="file.wav"></source> </audio>
thank you.
i'd try this:
$('some-button').on('click', function(){ $('audio')[0].play(); });
in other words - use button receive click , find audio
element , make start playing.
there small, specialized example here:
note music licensed under creative commons by-cc-sa, see further info here.
Comments
Post a Comment