Reputation: 11
using html css and javascript is there a way to play a background music for an iphone webapp
for example when a link is clicked in the webapp a sound should play in the background without repeating and while the sound is playing the browser should not open any apps from the iphone instead the html page which has the link should stay the way it is and only the sound should play in the background
Upvotes: 1
Views: 9653
Reputation: 17
He is not asking if Safari play audio in the background. He is asking to play audio or sound, and switch to another app at the same time. That was possible with IOS 10 but seems not to work on IOS 12.3
The old trick was to start playing the webpage sounds, click home button (sounds stop) then swipe the control panel up, and click the play button on the music control panel.
While this may work with Youtube, it does NOT work with native sounds of the browser or speech synthesis.
Upvotes: 0
Reputation: 1
All technical documents I find say that you can play sound in IOS safari, but you must call up a Controller to start playing. There seems to be no way to autoplay a sound when a page opens, or when an event happens, even with javascript.
Upvotes: 0
Reputation: 5071
I looked quite a while to figure this out, so I might as well leave this here:
https://gist.github.com/1269911
Upvotes: 0
Reputation: 312
Yes you can play music in the background using the Audio() object.
Live demo: http://we-are-gurus.com/labs/audio/
Upvotes: -1
Reputation: 2224
Sure You Can Checkout Here Both Have Successful Test With iphone/ipod touch/ipad
http://html5doctor.com/native-audio-in-the-browser/
http://www.html5laboratory.com/playing-with-audio-files.php
Upvotes: -1
Reputation: 31304
Sure - take a look at the HTML5 tag (http://www.w3schools.com/html5/tag_audio.asp). You can trigger playback using Javascript, and it plays back within the browser (in this case, mobile safari). The link above should be a good starting point.
Upvotes: 0