Title: [200516] trunk
- Revision
- 200516
- Author
- jer.no...@apple.com
- Date
- 2016-05-06 12:54:15 -0700 (Fri, 06 May 2016)
Log Message
Muted media elements should be allowed to autoplay, even if RequireUserGestureForAudioRateChange is set.
https://bugs.webkit.org/show_bug.cgi?id=157404
<rdar://problem/26016802>
Reviewed by Eric Carlson.
Source/WebCore:
Test: media/audio-playback-restriction-play-muted.html
Add element.muted() as a critera of whether playback is permitted when
RequireUserGestureForAudioRateChange is set. Also, make sure to re-evaluate whether the
element should be playing when muted is changed without a user gesture.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setMuted):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted):
LayoutTests:
* media/audio-playback-restriction-play-muted-expected.txt: Added.
* media/audio-playback-restriction-play-muted.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (200515 => 200516)
--- trunk/LayoutTests/ChangeLog 2016-05-06 19:25:41 UTC (rev 200515)
+++ trunk/LayoutTests/ChangeLog 2016-05-06 19:54:15 UTC (rev 200516)
@@ -1,3 +1,14 @@
+2016-05-06 Jer Noble <jer.no...@apple.com>
+
+ Muted media elements should be allowed to autoplay, even if RequireUserGestureForAudioRateChange is set.
+ https://bugs.webkit.org/show_bug.cgi?id=157404
+ <rdar://problem/26016802>
+
+ Reviewed by Eric Carlson.
+
+ * media/audio-playback-restriction-play-muted-expected.txt: Added.
+ * media/audio-playback-restriction-play-muted.html: Added.
+
2016-05-06 Manuel Rego Casasnovas <r...@igalia.com>
[css-grid] Unprefix CSS Grid Layout properties
Added: trunk/LayoutTests/media/audio-playback-restriction-play-muted-expected.txt (0 => 200516)
--- trunk/LayoutTests/media/audio-playback-restriction-play-muted-expected.txt (rev 0)
+++ trunk/LayoutTests/media/audio-playback-restriction-play-muted-expected.txt 2016-05-06 19:54:15 UTC (rev 200516)
@@ -0,0 +1,12 @@
+Test that, when RequireUserGestureForAudioRateChange is set, starting playback of an muted audio file does not require a user gesture.
+
+
+RUN(internals.setMediaElementRestrictions(video, "RequireUserGestureForAudioRateChange"))
+RUN(video.src = "" "content/test"))
+EVENT(canplaythrough)
+RUN(video.play())
+EVENT(playing)
+RUN(video.muted = false)
+EVENT(pause)
+END OF TEST
+
Added: trunk/LayoutTests/media/audio-playback-restriction-play-muted.html (0 => 200516)
--- trunk/LayoutTests/media/audio-playback-restriction-play-muted.html (rev 0)
+++ trunk/LayoutTests/media/audio-playback-restriction-play-muted.html 2016-05-06 19:54:15 UTC (rev 200516)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>audio-playback-restriction</title>
+ <script src=""
+ <script src=""
+
+ <script>
+ function runTest()
+ {
+ video = document.getElementsByTagName('audio')[0];
+
+ if (window.internals)
+ run('internals.setMediaElementRestrictions(video, "RequireUserGestureForAudioRateChange")');
+
+ waitForEventAndFail('error');
+ waitForEvent('canplaythrough', canplaythrough);
+ run('video.src = "" "content/test")');
+ }
+
+ function canplaythrough()
+ {
+ waitForEvent('playing', playing);
+ run('video.play()');
+ }
+
+ function playing()
+ {
+ run('video.muted = false');
+ waitForEventAndEnd('pause');
+ failTestIn(100);
+ }
+ </script>
+</head>
+
+<body _onload_="runTest()">
+ <p>Test that, when RequireUserGestureForAudioRateChange is set, starting playback of an muted audio file does not require a user gesture.</p>
+ <audio muted controls></audio>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (200515 => 200516)
--- trunk/Source/WebCore/ChangeLog 2016-05-06 19:25:41 UTC (rev 200515)
+++ trunk/Source/WebCore/ChangeLog 2016-05-06 19:54:15 UTC (rev 200516)
@@ -1,3 +1,22 @@
+2016-05-06 Jer Noble <jer.no...@apple.com>
+
+ Muted media elements should be allowed to autoplay, even if RequireUserGestureForAudioRateChange is set.
+ https://bugs.webkit.org/show_bug.cgi?id=157404
+ <rdar://problem/26016802>
+
+ Reviewed by Eric Carlson.
+
+ Test: media/audio-playback-restriction-play-muted.html
+
+ Add element.muted() as a critera of whether playback is permitted when
+ RequireUserGestureForAudioRateChange is set. Also, make sure to re-evaluate whether the
+ element should be playing when muted is changed without a user gesture.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setMuted):
+ * html/MediaElementSession.cpp:
+ (WebCore::MediaElementSession::playbackPermitted):
+
2016-05-06 Brent Fulgham <bfulg...@apple.com>
Don't use invalidated ResourceLoadStatistics iterators
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (200515 => 200516)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-05-06 19:25:41 UTC (rev 200515)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-05-06 19:54:15 UTC (rev 200516)
@@ -3288,6 +3288,8 @@
}
scheduleEvent(eventNames().volumechangeEvent);
+ updateShouldPlay();
+
#if ENABLE(MEDIA_SESSION)
document().updateIsPlayingMedia(m_elementID);
#else
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (200515 => 200516)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2016-05-06 19:25:41 UTC (rev 200515)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2016-05-06 19:54:15 UTC (rev 200516)
@@ -159,7 +159,7 @@
return false;
}
- if (m_restrictions & RequireUserGestureForAudioRateChange && (!element.isVideo() || element.hasAudio()) && !ScriptController::processingUserGestureForMedia()) {
+ if (m_restrictions & RequireUserGestureForAudioRateChange && (!element.isVideo() || element.hasAudio()) && !element.muted() && !ScriptController::processingUserGestureForMedia()) {
LOG(Media, "MediaElementSession::playbackPermitted - returning FALSE because of audio rate change restriction");
return false;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes