jquery - Not able to play sound on iphone using JavaScript but able to play on Android -
i trying play sound notification on android , iphone using javascript library able play sound on android , not on iphone.
i using javascript ion.sound.play("beep")
function play sound. have kept sound file in folder. can 1 me out; how can play sound on iphone using javascript?
the sounds require user input in ios9. can initialize sound "invisible" button disappears after 1 press @ initialization of app. once triggered, should able call ion.sound.play("beep") programatically. you.
css:
<style> #init { position: absolute; margin-right: 0px; margin-left: 0px; margin-top: 0px; margin-bottom: 0px; z-index: 1000; } </style>
javascript:
if((navigator.useragent.match(/iphone/i)) || (navigator.useragent.match(/ipod/i)) || (navigator.useragent.match(/ipad/i))) { document.write('<a id="init" ontouchstart="javascript:sndinit();"></a>'); function sndinit(){ ion.sound.play("beep"); ion.sound.pause("beep"); document.getelementbyid('init').style.display = 'none'; } }
Comments
Post a Comment