I have a web app (mobile 4.0) that uses html5 audio to play an mp3 file. When the app goes into the background, the audio pauses automatically. I need the audio to keep playing in the background.
The app has background support enabled and declares the “media” background category. I added a console.log statement on a loop to confirm that the app is still running in the background, and it appears to be the case but the audio is still paused. What am I doing wrong?
Here’s a simple reproduction (based on creating a Basic Web Application in Tizen Studio).
You can see the visibilitychange event fires as the app goes into the background, and the ‘pause’ event fires on the audio. The app is still running in the background.
Web app runs in background, but audio pauses
I have a web app (mobile 4.0) that uses html5 audio to play an mp3 file. When the app goes into the background, the audio pauses automatically. I need the audio to keep playing in the background.
The app has background support enabled and declares the “media” background category. I added a console.log statement on a loop to confirm that the app is still running in the background, and it appears to be the case but the audio is still paused. What am I doing wrong?
Here’s a simple reproduction (based on creating a Basic Web Application in Tizen Studio).
config.xml
main.js
When I run the app in an emulator, I see the following log output:
01-31 09:06:27.340 : Debug / ConsoleMessage ( 2842 : 2842 ) : [59hzphXAzx] file:///js/main.js:27: App is still running…
01-31 09:06:30.080 : Debug / ConsoleMessage ( 2842 : 2842 ) : [59hzphXAzx] file:///js/main.js:14: Visibility change! Hidden: true
01-31 09:06:30.080 : Debug / ConsoleMessage ( 2842 : 2842 ) : [59hzphXAzx] file:///js/main.js:19: Audio paused!
01-31 09:06:33.000 : Debug / ConsoleMessage ( 2842 : 2842 ) : [59hzphXAzx] file:///js/main.js:27: App is still running…
01-31 09:06:39.000 : Debug / ConsoleMessage ( 2842 : 2842 ) : [59hzphXAzx] file:///js/main.js:27: App is still running…
01-31 09:06:45.010 : Debug / ConsoleMessage ( 2842 : 2842 ) : [59hzphXAzx] file:///js/main.js:27: App is still running…
You can see the visibilitychange event fires as the app goes into the background, and the ‘pause’ event fires on the audio. The app is still running in the background.
BY
16 Apr 2025
Tizen Studio
BY
04 Nov 2024
Tizen Studio
BY
02 Apr 2024
Tizen Studio