Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
A HTMLMediaElement created while page is interrupted should be able t…
…o autoplay https://bugs.webkit.org/show_bug.cgi?id=241783 Patch by Youenn Fablet <youennf@gmail.com> on 2022-06-21 Reviewed by Eric Carlson. Previously, a session created while manager is interrupted would get its state set to interrupted. When end of interruption happens, it would not be restarted since its interruption count would be set to 0. Instead, manager now stores the last interruption. In case of a new session, we now call beginInterruption instead of setting the session state directly. This allows to have an interruption count set to 1 and thus uninterrupt the session when the end of interruption signal happens. Covered by added test. * LayoutTests/fast/mediastream/video-created-while-interrupted-expected.txt: Added. * LayoutTests/fast/mediastream/video-created-while-interrupted.html: Added. * Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp: (WebCore::PlatformMediaSessionManager::beginInterruption): (WebCore::PlatformMediaSessionManager::endInterruption): (WebCore::PlatformMediaSessionManager::addSession): (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback): (WebCore::PlatformMediaSessionManager::processSystemWillSleep): (WebCore::PlatformMediaSessionManager::processSystemDidWake): * Source/WebCore/platform/audio/PlatformMediaSessionManager.h: (WebCore::PlatformMediaSessionManager::isInterrupted const): Canonical link: https://commits.webkit.org/251691@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
5ba989b
commit 21d50bf
Showing
4 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
|
||
PASS Correctly handle autoplay for a media element created while page is interrupted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Capture source interruption.</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
promise_test(async (test) => { | ||
if (window.internals) | ||
internals.beginAudioSessionInterruption(); | ||
|
||
const video = document.createElement('video'); | ||
video.autoplay = true; | ||
document.body.appendChild(video); | ||
|
||
const stream = await navigator.mediaDevices.getUserMedia({audio: true}); | ||
video.srcObject = stream; | ||
|
||
let counter = 0; | ||
while(++counter < 100 && video.paused) | ||
await new Promise(resolve => setTimeout(resolve, 50)); | ||
|
||
assert_false(video.paused); | ||
}, "Correctly handle autoplay for a media element created while page is interrupted"); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters