Bug 261858

Summary: [iOS 16.x & iOS 17.x] autoplay in audio element and media session controls not working in standalone web app (pwa) when playback ends
Product: WebKit Reporter: Aaron <clark1729>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: clark1729, eric.carlson, jer.noble, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: iPhone / iPad   
OS: iOS 17   

Description Aaron 2023-09-20 20:11:28 PDT
Steps:
1. play a song in standalone web app
2. return to homescreen and leave the music in the background

What happened:
When the song ends, it is simply paused. The next song isn't played. The buttons (prev, play, next) in the lockscreen's music controls have no response (some handlers are registered in MediaSession). Once I enter the web app, it continues to play the next song normally.

Expected:
When the song ends, the callback is called normally to play the next song.

More info:
1. There are no errors or warnings in the devtools' console.
2. Handlers registered in MediaSession excuted normally when a song is playing.
3. Audio events like `ended` and `canplay` triggers normally.
4. It works fine as a normal website opened in Safari (instead of being added to homesreen).
5. It works fine in iOS 15.

If you need to reproduce the problem, the website is https://carllllo.work/music/. Click the green text "播放全部" button on the top right panel and it should start playing a list of songs.

If you need any extra information, I am willing to help.

Thanks for your time.
Comment 1 Radar WebKit Bug Importer 2023-09-27 20:12:31 PDT
<rdar://problem/116156954>