Home > Technical & Creative Skills > Programming, Servers & Scripts

Sound on Mobile Landers, How? (8)


06-26-2014 01:02 AM #1 karim0028 (Member)
Sound on Mobile Landers, How?

Hey Guys,

How doi get sound to play on a mobile lander?

I tried nifty player

http://www.varal.org/media/niftyplayer/

but it doesnt seem to play on my iphone.... Desktop it plays fine, so im not sure if the scripts used in nifty player are not supported on mobile and/or iphone...

Any other alternatives or best practices?


06-26-2014 03:47 AM #2 nefig (Member)

Try this

Code:
<audio autoplay="autoplay" preload>
<source src="images/alert.ogg" type="audio/ogg" />
<source src="images/alert.mp3" type="audio/mpeg" />
</audio>
I cant guarantee it will work - havent tested it but seen it somewhere. Obviously ogg/mp3 files must be super-tiny. Dont know why both, probably to ensure playback in most browsers.


06-26-2014 04:43 AM #3 karim0028 (Member)

thanks, i just tried it....

Still works on my desktop but no sound on my iphone...


06-26-2014 05:21 AM #4 zeno (Administrator)

https://developer.mozilla.org/en-US/...udio_and_video''

and

http://caniuse.com/audio

Should work on your iPhone if done right.

Not I don't think you want autoplay="autoplay". More like:

<audio src="something.mp3" autoplay controls></audio>

Add preload="..." if you want to control that.


06-26-2014 05:40 AM #5 karim0028 (Member)

@zeno, tried this, but still doesnt seem to work on iphone....


06-26-2014 07:27 AM #6 Mr Green (Administrator)

I've tried audio and failed. Curious if anyone has actually got it to work across a bunch of phones.


06-26-2014 08:50 AM #7 zeno (Administrator)

The glaring issue is that Safari prevents the autoplay of audio. You can however use javascript to make something play the moment someone touches the screen, scrolls, clicks etc.

Otherwise audio should work fine on most mobile browsers? I haven't tested it.


06-26-2014 12:53 PM #8 karim0028 (Member)

im on google chrome on iphone... So, it appears you might not be able to do it on iphone...


Home > Technical & Creative Skills > Programming, Servers & Scripts