iOS Audio Lockscreen Problem in PWA
Description
When running a PWA on iOS; playing audio from the lockscreen works as expected until you leave the audio paused for 30 seconds. After this, the audio will cease to function until you return the PWA to the foreground.
Reproduction
- In a PWA, create an HTML 5 audio element.
- Load an audio file into it.
- Set
navigator.mediaSession
data and action handlers for play and pause. - Everything is in working order and your audio plays and pauses from the lock screen.
- Pause your audio and wait for 30 seconds.
- Now, press the play button. Your audio will no longer function.
- At this point, the only way to get the audio to function again is to open the PWA into the foreground. Once you do this, the audio will be in working order.
What is expected
In step number 6, when you press the play button, the audio should play. The lock screen audio should not enter a non-functional state or there should be some way to "wake up" the PWA.
Closing
If you follow these steps exactly on Android, you will see that the problem does not exist on those devices.