WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 261554
[iOS] AudioContext is getting suspended when page goes in the background even if navigator.audioSession.type is set to playback
https://bugs.webkit.org/show_bug.cgi?id=261554
Summary
[iOS] AudioContext is getting suspended when page goes in the background even...
youenn fablet
Reported
2023-09-14 04:06:13 PDT
[iOS] AudioContext is getting suspended when page goes in the background even if navigator.audioSession.type is set to playback
Attachments
Audio File for Test Case
(89.07 KB, audio/x-m4a)
2024-01-16 14:05 PST
,
Kin Blas
no flags
Details
Minimal Test Case that Demonstrates the Issue
(4.93 KB, text/html)
2024-01-16 14:09 PST
,
Kin Blas
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2023-09-14 04:06:29 PDT
<
rdar://problem/115485355
>
youenn fablet
Comment 2
2023-09-14 05:19:59 PDT
We probably want the behaviour to match what happens for regular audio elements.
youenn fablet
Comment 3
2023-09-15 06:03:39 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/17812
Kin Blas
Comment 4
2024-01-16 14:05:40 PST
Created
attachment 469422
[details]
Audio File for Test Case Added an audio file for a minimal test case that demonstrates the issue.
Kin Blas
Comment 5
2024-01-16 14:09:31 PST
Created
attachment 469423
[details]
Minimal Test Case that Demonstrates the Issue Attaching a minimal test case that can be used to demonstrate the issue.
Kin Blas
Comment 6
2024-01-16 16:05:37 PST
We are experiencing this issue within our web app. Calling suspend() and resume() have no affect and triggering play() and pause() dispatches events as expected but timeupdates are never dispatched which I guess is expected since playback is never resumed.
Judah Gabriel Himango
Comment 7
2024-01-18 15:38:58 PST
I have a music player app that is impacted by this bug. Minimal repro:
https://judahtemp.b-cdn.net/ios-webkit-audio-bug/bug.html
I just have a single <audio> element in my web app. When the current song ends (via .ended event), I change the audio element src to the new song, and call .play(). This works, unless the page is in the background or the screen is locked. If it is, the .ended event still fires, I can change the .src of the audio and call .play(), but no audio is heard. This bug appears to have been introduced in iOS 17.2.1. It works fine on previous iOS versions, and it works on Android, Mac, and Windows.
RobLaw85
Comment 8
2024-01-28 12:24:19 PST
Is there any update on a resolution to this issue? This issue was first introduced in iOS 17.0 and fixed in iOS 17.1 update. (Reference links below) iOS 17 - 17.1 (Marked as RESOLVED FIXED Sept. 11 2023) AudioContext.createMediaElementSource broken in iOS 17
https://forums.developer.apple.com/forums/thread/740276
HTML5 audio player fails after upgrading iPhone to iOS 17
https://discussions.apple.com/thread/255235567
Bug 261414
- [iOS][GPUP] Allow required syscalls
https://bugs.webkit.org/show_bug.cgi?id=261414
PR 17654 with fix included in iOS 17.1
https://github.com/WebKit/WebKit/pull/17654
Then was broken again in iOS 17.2 - 17.3 iOS 17.2.1 (21C66) Broke Audio Streaming from Safari When Not in Focus
https://discussions.apple.com/thread/255413652
Please let me know if any additional information is needed. Thank you :)
Javi Velasco
Comment 9
2024-02-01 08:34:31 PST
Any updates on the resolution of this issue? I'm suffering from this bug in a web player I'm currently building.
RobLaw85
Comment 10
2024-02-11 05:50:26 PST
Any update? This issue is still present in the latest iOS 17.3.1 update released last week.
youenn fablet
Comment 11
2024-02-19 04:42:28 PST
The current PR needs to address a few more things before being ready. I plan to work on this in the next couple of weeks.
RobLaw85
Comment 12
2024-02-19 07:38:44 PST
Thank you for the update!!
youenn fablet
Comment 13
2024-03-01 08:19:30 PST
(In reply to Kin Blas from
comment #6
)
> We are experiencing this issue within our web app. Calling suspend() and > resume() have no affect and triggering play() and pause() dispatches events > as expected but timeupdates are never dispatched which I guess is expected > since playback is never resumed.
I filed
https://bugs.webkit.org/show_bug.cgi?id=270352
to keep track of this bug. I am not sure what the actual issue is.
EWS
Comment 14
2024-03-01 09:07:13 PST
Committed
275558@main
(b848143a2ad5): <
https://commits.webkit.org/275558@main
> Reviewed commits have been landed. Closing PR #17812 and removing active labels.
craigwharding
Comment 15
2024-03-10 16:00:08 PDT
Do we know what iOS update this will be apart of? Do we know why this bug keeps coming back into the mix when it was fixed on previous versions?
Luming Yin
Comment 16
2024-03-17 03:58:05 PDT
If anyone needs a temporary workaround, you can add another silent audio element to the same page. Both the tag and the referenced audio file need to exist, but the audio doesn't need to be playing: <audio src="silent_audio.mp3" type="audio/mpeg"></audio> After this, next track, back, and forward will work for the main audio element when the browser or web view is suspended.
craigwharding
Comment 17
2024-03-17 16:49:45 PDT
(In reply to Luming Yin from
comment #16
)
> If anyone needs a temporary workaround, you can add another silent audio > element to the same page. Both the tag and the referenced audio file need to > exist, but the audio doesn't need to be playing: > <audio src="silent_audio.mp3" type="audio/mpeg"></audio> > > After this, next track, back, and forward will work for the main audio > element when the browser or web view is suspended.
This does not work for me. It creates a second audio player which I don't use, but after the song finishes after Safari doesn't have focus, the song ends and next doesn't play.
Kin Blas
Comment 18
2024-03-18 14:25:17 PDT
(In reply to Luming Yin from
comment #16
)
> If anyone needs a temporary workaround, you can add another silent audio > element to the same page. Both the tag and the referenced audio file need to > exist, but the audio doesn't need to be playing: > <audio src="silent_audio.mp3" type="audio/mpeg"></audio> > > After this, next track, back, and forward will work for the main audio > element when the browser or web view is suspended.
The workaround didn't seem to work for us either. Do you have a working sample you could show us?
RobLaw85
Comment 19
2024-05-14 04:33:32 PDT
The latest iOS update to 17.5 (Apple iPhone) has resolved the issues we were experiencing. Thank you to all teams evolved!
EWS
Comment 20
2024-06-06 13:27:46 PDT
Committed
272448.1072@safari-7618-branch
(78693e77bdd4): <
https://commits.webkit.org/272448.1072@safari-7618-branch
> Reviewed commits have been landed. Closing PR #1329 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug