WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
229688
REGRESSION (iOS 15): HTMLAudioElement fails to load new audio when device is locked or safari is in background
https://bugs.webkit.org/show_bug.cgi?id=229688
Summary
REGRESSION (iOS 15): HTMLAudioElement fails to load new audio when device is ...
Rick Li
Reported
2021-08-30 15:11:01 PDT
Hi, we are currently attempting to get Safari to auto move on to the next audio track when a track ends. By executing JavaScript that replaces the src attribute with a new mp3, it worked fine with IOS 14. However in IOS 15 Beta - 15.0 (19A5325f) if the screen is locked or safari is in the background, playback terminates at the end of the first track and does not progress to the second. No error is raised. To test, please use
https://521dimensions.com/open-source/amplitudejs
Attachments
Patch
(11.45 KB, patch)
2022-01-21 12:23 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Patch
(12.75 KB, patch)
2022-01-21 15:09 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Patch
(18.32 KB, patch)
2022-01-22 13:49 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Patch for landing
(19.09 KB, patch)
2022-01-24 08:41 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Address post-review feedback
(1.58 KB, patch)
2022-01-24 15:08 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Patch
(15.09 KB, patch)
2022-04-27 07:35 PDT
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-08-30 16:55:01 PDT
<
rdar://problem/82554226
>
Eric Carlson
Comment 2
2022-01-21 12:23:45 PST
Created
attachment 449683
[details]
Patch
Eric Carlson
Comment 3
2022-01-21 15:09:44 PST
Created
attachment 449698
[details]
Patch
Jer Noble
Comment 4
2022-01-21 17:47:47 PST
Comment on
attachment 449698
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=449698&action=review
> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:146 > + if (!hasAudibleAudioOrVideoMediaType && m_previousHadAudibleAudioOrVideoMediaType) { > + if (!m_delayCategoryChangeTimer.isActive()) { > + m_delayCategoryChangeTimer.startOneShot(delayBeforeSettingCategoryNone); > + ALWAYS_LOG(LOGIDENTIFIER, "setting timer"); > + } > + hasAudibleAudioOrVideoMediaType = true; > + } > + m_previousHadAudibleAudioOrVideoMediaType = hasAudibleAudioOrVideoMediaType; > +
I wonder what will happen when a page is using WebAudio; we may go from Playback -> Ambient without hitting this timer.
> Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp:-148 > -#if PLATFORM(COCOA) > return m_category; > -#else > - return AudioSession::CategoryType::None; > -#endif
Is this necessary?
> LayoutTests/ChangeLog:12 > + * media/audio-session-category-expected.txt: Added. > + * media/audio-session-category.html: Added.
Should these go into platform/ios/media or platform/mac/media?
Jer Noble
Comment 5
2022-01-21 17:55:36 PST
Comment on
attachment 449698
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=449698&action=review
> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:133 > + m_delayCategoryChangeTimer.stop();
I think this may be in the wrong place. It'll only get hit if there are no audible <video> or <audio> elements, but the session is "potentially audible".
> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:145 > + if (!hasAudibleAudioOrVideoMediaType && m_previousHadAudibleAudioOrVideoMediaType) { > + if (!m_delayCategoryChangeTimer.isActive()) { > + m_delayCategoryChangeTimer.startOneShot(delayBeforeSettingCategoryNone); > + ALWAYS_LOG(LOGIDENTIFIER, "setting timer"); > + } > + hasAudibleAudioOrVideoMediaType = true; > + } > + m_previousHadAudibleAudioOrVideoMediaType = hasAudibleAudioOrVideoMediaType;
I think it should move down here, in an "else" statement after the "if" (which may need to be restructured). Maybe something like: if (hasAudibleAudioOrVideoMediaType) m_delayCategoryChangeTimer.stop(); else if (m_previousHadAudibleAudioOrVideoMediaType) { .... }
Eric Carlson
Comment 6
2022-01-22 13:49:07 PST
Created
attachment 449735
[details]
Patch
Eric Carlson
Comment 7
2022-01-24 08:41:23 PST
Created
attachment 449821
[details]
Patch for landing
Eric Carlson
Comment 8
2022-01-24 13:24:19 PST
Comment on
attachment 449821
[details]
Patch for landing Test failures are unrelated.
EWS
Comment 9
2022-01-24 14:06:36 PST
Committed
r288466
(
246352@main
): <
https://commits.webkit.org/246352@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 449821
[details]
.
Darin Adler
Comment 10
2022-01-24 14:10:18 PST
Comment on
attachment 449821
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=449821&action=review
> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:97 > + static const Seconds delayBeforeSettingCategoryNone = { 2_s };
constexpr auto delayBeforeSettingCategoryNone = 2_s;
Eric Carlson
Comment 11
2022-01-24 15:08:04 PST
Reopening to attach new patch.
Eric Carlson
Comment 12
2022-01-24 15:08:05 PST
Created
attachment 449867
[details]
Address post-review feedback
EWS
Comment 13
2022-01-24 17:25:05 PST
Committed
r288493
(
246365@main
): <
https://commits.webkit.org/246365@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 449867
[details]
.
Eric Carlson
Comment 14
2022-04-27 07:35:27 PDT
Reopening to attach new patch.
Eric Carlson
Comment 15
2022-04-27 07:35:29 PDT
Created
attachment 458443
[details]
Patch
Eric Carlson
Comment 16
2022-04-27 08:53:55 PDT
Comment on
attachment 458443
[details]
Patch Nothing to see here, I attached the patch to the wrong bug.
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