Yozone W.
Yozone W.

Reputation: 303

How to continue play html5 audio when screen locked?

I have an audio element in the UIWebView, but when I lock the screen, the audio will be paused. How can I continue to play it when the screen locked?

Upvotes: 2

Views: 1668

Answers (2)

Karim Mourra
Karim Mourra

Reputation: 57

You must ensure that background audio is enabled in your iOS app. You can find a sample project here https://github.com/jsagorin/iOSBackgroundAudio

Upvotes: 0

electronicKT
electronicKT

Reputation: 68

If you are talking about iOS devices, then as long as you do not bookmark the site to the home screen and Safari is open and playing the audio, it will continue to play when the screen locks. Only if you try to multi-task will it shut off the sound on your page.

Upvotes: 2

Related Questions