Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play sound in iPhone web app with Javascript?

I'm currently creating an iPhone web application for piano chords, and I wanted to add an option that would let the user press a Play button and play the selected chord. However, I'm not sure how to do this, or if it's even possible.

Basically, is there any way to programmatically (through Javascript) play a sound file (wav, mp3,...) in the background? (i.e. not leaving the page)

Thanks for any help!

(Keep in mind that I'm developing a web app, so I'm using HTML, CSS & JS, not the native SDK)

like image 521
blabus Avatar asked Feb 28 '23 02:02

blabus


2 Answers

short answer: no

from the docs:

Safari on iPhone plays audio and video in webpages in fullscreen playback mode only.

like image 58
cobbal Avatar answered Mar 07 '23 09:03

cobbal


yes you can.

http://www.schillmania.com/projects/soundmanager2/

see it in action at soundcloud.com

like image 38
mike Avatar answered Mar 07 '23 10:03

mike