Title: [208092] trunk
Revision
208092
Author
jer.no...@apple.com
Date
2016-10-28 18:18:45 -0700 (Fri, 28 Oct 2016)

Log Message

WebAudio does not resume when moving from background to foreground tab.
https://bugs.webkit.org/show_bug.cgi?id=164043

Reviewed by Darin Adler.

Source/WebCore:

Test: webaudio/page-canstartmedia.html

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::mediaCanStart):

LayoutTests:

* webaudio/page-canstartmedia-expected.txt: Added.
* webaudio/page-canstartmedia.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208091 => 208092)


--- trunk/LayoutTests/ChangeLog	2016-10-29 01:17:43 UTC (rev 208091)
+++ trunk/LayoutTests/ChangeLog	2016-10-29 01:18:45 UTC (rev 208092)
@@ -1,3 +1,13 @@
+2016-10-28  Jer Noble  <jer.no...@apple.com>
+
+        WebAudio does not resume when moving from background to foreground tab.
+        https://bugs.webkit.org/show_bug.cgi?id=164043
+
+        Reviewed by Darin Adler.
+
+        * webaudio/page-canstartmedia-expected.txt: Added.
+        * webaudio/page-canstartmedia.html: Added.
+
 2016-10-28  Wenson Hsieh  <wenson_hs...@apple.com>
 
         iOS autocorrection does not trigger an input event of inputType "insertReplacementText"

Added: trunk/LayoutTests/webaudio/page-canstartmedia-expected.txt (0 => 208092)


--- trunk/LayoutTests/webaudio/page-canstartmedia-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webaudio/page-canstartmedia-expected.txt	2016-10-29 01:18:45 UTC (rev 208092)
@@ -0,0 +1,9 @@
+Tests that AudioContext resume method resolve promises when notified by Page that it can start media playback.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS context resolve callback called
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/webaudio/page-canstartmedia.html (0 => 208092)


--- trunk/LayoutTests/webaudio/page-canstartmedia.html	                        (rev 0)
+++ trunk/LayoutTests/webaudio/page-canstartmedia.html	2016-10-29 01:18:45 UTC (rev 208092)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+<script src=""
+</head>
+
+<body>
+
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+description("Tests that AudioContext resume method resolve promises when notified by Page that it can start media playback.");
+
+function runTest() {
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    if (window.internals)
+        internals.settings.setCanStartMedia(false);
+
+    window.jsTestIsAsync = true;
+
+    context = new webkitAudioContext();
+
+    context.resume().then(resumePromiseResolved).catch(resumePromiseRejected);
+
+    setTimeout(allowStartMedia, 100);
+}
+
+function allowStartMedia() {
+    if (window.internals)
+        internals.settings.setCanStartMedia(true);
+}
+
+function resumePromiseResolved() {
+    testPassed('context resolve callback called')
+    finishJSTest();
+}
+
+function resumePromiseRejected() {
+    testFailed('context reject callback called');
+    finishJSTest();
+}
+
+runTest();
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (208091 => 208092)


--- trunk/Source/WebCore/ChangeLog	2016-10-29 01:17:43 UTC (rev 208091)
+++ trunk/Source/WebCore/ChangeLog	2016-10-29 01:18:45 UTC (rev 208092)
@@ -1,3 +1,15 @@
+2016-10-28  Jer Noble  <jer.no...@apple.com>
+
+        WebAudio does not resume when moving from background to foreground tab.
+        https://bugs.webkit.org/show_bug.cgi?id=164043
+
+        Reviewed by Darin Adler.
+
+        Test: webaudio/page-canstartmedia.html
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::mediaCanStart):
+
 2016-10-28  Wenson Hsieh  <wenson_hs...@apple.com>
 
         iOS autocorrection does not trigger an input event of inputType "insertReplacementText"

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (208091 => 208092)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-10-29 01:17:43 UTC (rev 208091)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-10-29 01:18:45 UTC (rev 208092)
@@ -960,6 +960,7 @@
 void AudioContext::mediaCanStart()
 {
     removeBehaviorRestriction(AudioContext::RequirePageConsentForAudioStartRestriction);
+    mayResumePlayback(true);
 }
 
 MediaProducer::MediaStateFlags AudioContext::mediaState() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to