Title: [239189] trunk
Revision
239189
Author
you...@apple.com
Date
2018-12-13 17:17:57 -0800 (Thu, 13 Dec 2018)

Log Message

Trying to play a media element synchronously after setting srcObject should succeed without user gesture
https://bugs.webkit.org/show_bug.cgi?id=192679

Reviewed by Eric Carlson.

Source/WebCore:

Check the srcObject mediaProvider value which is set synchronously.
Covered by updated fast/mediastream/local-audio-playing-event.html.

* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::hasMediaStreamSrcObject const):

LayoutTests:

* fast/mediastream/local-audio-playing-event-expected.txt:
* fast/mediastream/local-audio-playing-event.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239188 => 239189)


--- trunk/LayoutTests/ChangeLog	2018-12-14 00:53:11 UTC (rev 239188)
+++ trunk/LayoutTests/ChangeLog	2018-12-14 01:17:57 UTC (rev 239189)
@@ -1,3 +1,13 @@
+2018-12-13  Youenn Fablet  <you...@apple.com>
+
+        Trying to play a media element synchronously after setting srcObject should succeed without user gesture
+        https://bugs.webkit.org/show_bug.cgi?id=192679
+
+        Reviewed by Eric Carlson.
+
+        * fast/mediastream/local-audio-playing-event-expected.txt:
+        * fast/mediastream/local-audio-playing-event.html:
+
 2018-12-13  Per Arne Vollan  <pvol...@apple.com>
 
         [macOS] Inline WebVTT styles should override styles from Captions settings in System Preferences

Modified: trunk/LayoutTests/fast/mediastream/local-audio-playing-event-expected.txt (239188 => 239189)


--- trunk/LayoutTests/fast/mediastream/local-audio-playing-event-expected.txt	2018-12-14 00:53:11 UTC (rev 239188)
+++ trunk/LayoutTests/fast/mediastream/local-audio-playing-event-expected.txt	2018-12-14 01:17:57 UTC (rev 239189)
@@ -1,3 +1,4 @@
 
 PASS Local audio playback fires playing event 
+PASS Calling play synchronously after setting srcObject shoud play and fire playing event 
 

Modified: trunk/LayoutTests/fast/mediastream/local-audio-playing-event.html (239188 => 239189)


--- trunk/LayoutTests/fast/mediastream/local-audio-playing-event.html	2018-12-14 00:53:11 UTC (rev 239188)
+++ trunk/LayoutTests/fast/mediastream/local-audio-playing-event.html	2018-12-14 01:17:57 UTC (rev 239189)
@@ -8,19 +8,23 @@
 </head>
 <body>
     <audio id="audio" autoplay></audio>
+    <audio id="audioNoAutoplay" autoplay></audio>
     <script>
     if (window.testRunner)
         testRunner.setUserMediaPermission(true);
 
-    var audio = document.getElementById('audio');
+    promise_test(async (test) => {
+        audio.srcObject = await navigator.mediaDevices.getUserMedia({audio: true});
+        var eventWatcher = new EventWatcher(test, audio, 'playing');
+        return eventWatcher.wait_for('playing');
+    }, 'Local audio playback fires playing event');
 
-    promise_test((test) => {
-        return navigator.mediaDevices.getUserMedia({audio: true}).then((stream) => {
-            audio.srcObject = stream;
-            var eventWatcher = new EventWatcher(test, audio, 'playing');
-            return eventWatcher.wait_for('playing');
-        });
-    }, 'Local audio playback fires playing event');
+    promise_test(async (test) => {
+        audioNoAutoplay.srcObject = await navigator.mediaDevices.getUserMedia({audio: true});
+        audioNoAutoplay.play();
+        var eventWatcher = new EventWatcher(test, audioNoAutoplay, 'playing');
+        return eventWatcher.wait_for('playing');
+    }, 'Calling play synchronously after setting srcObject shoud play and fire playing event');
     </script>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (239188 => 239189)


--- trunk/Source/WebCore/ChangeLog	2018-12-14 00:53:11 UTC (rev 239188)
+++ trunk/Source/WebCore/ChangeLog	2018-12-14 01:17:57 UTC (rev 239189)
@@ -1,3 +1,16 @@
+2018-12-13  Youenn Fablet  <you...@apple.com>
+
+        Trying to play a media element synchronously after setting srcObject should succeed without user gesture
+        https://bugs.webkit.org/show_bug.cgi?id=192679
+
+        Reviewed by Eric Carlson.
+
+        Check the srcObject mediaProvider value which is set synchronously.
+        Covered by updated fast/mediastream/local-audio-playing-event.html.
+
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::hasMediaStreamSrcObject const):
+
 2018-12-13  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [iOS] Support dropping contact card data (public.vcard) in editable content

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (239188 => 239189)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2018-12-14 00:53:11 UTC (rev 239188)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2018-12-14 01:17:57 UTC (rev 239189)
@@ -553,7 +553,7 @@
 
 #if ENABLE(MEDIA_STREAM)
     void mediaStreamCaptureStarted() { resumeAutoplaying(); }
-    bool hasMediaStreamSrcObject() const { return !!m_mediaStreamSrcObject; }
+    bool hasMediaStreamSrcObject() const { return m_mediaProvider && WTF::holds_alternative<RefPtr<MediaStream>>(*m_mediaProvider); }
 #endif
 
     bool supportsSeeking() const override;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to