Janci
Janci

Reputation: 863

Javascript sounds in Android and Iphone browser

I'm developing simple javascript game, which should be embeded in Android and Iphone in-app browser. I have problem with sounds. I tried this, works good on PC, but not working on android and works strange with big delays on iphone.

init:

var hitSound = new Audio('hit.wav');

play:

hitSound.play();

How to play sounds without delay on Android and Iphone browser?

Upvotes: 0

Views: 1232

Answers (2)

Madhup Singh Yadav
Madhup Singh Yadav

Reputation: 8114

This would help.

look for the page section where this is discussed:

The above two functions should be placed in the HEAD section between a

      <script language="JavaScript" type="text/javascript"> and a

.

The best place and time to invoke the setEmbed function is in the BODY tag after page load:

      <body onload=   "setEmbed('sample',

'http://www.yourdomain.com/music/')">

Upvotes: 0

mdelolmo
mdelolmo

Reputation: 6447

I think you're trying to use a HTML5 feature, which is not fully supported by Android's browser, at least up to FroYo. Still, if you use Android's WebView you can do the trick, but probably you are avoiding Native apps, aren't you?

Upvotes: 1

Related Questions