<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[202100] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/202100">202100</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2016-06-15 12:32:50 -0700 (Wed, 15 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Make HTMLMediaElement.muted mutable
https://bugs.webkit.org/show_bug.cgi?id=158787
&lt;rdar://problem/24452567&gt;

Reviewed by Dean Jackson.

Source/WebCore:

Tests: media/audio-playback-restriction-removed-muted.html
       media/audio-playback-restriction-removed-track-enabled.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::audioTrackEnabledChanged): Remove most behavior restrictions if
  the track state was changed as a result of a user gesture.
(WebCore::HTMLMediaElement::setMuted): Ditto.
(WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Add mask
  parameter so caller can choose which restrictions are removed.
* html/HTMLMediaElement.h:

* html/MediaElementSession.cpp:
(WebCore::restrictionName): Drive-by fix: remove duplicate label.
* html/MediaElementSession.h:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Set muted on AVPlayer if setMuted
  was called before the player was created.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume): Drive-by fix: return early if there
  is no AVPlayer, not if we won't have metadata yet.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted): New.

LayoutTests:

* media/audio-playback-restriction-removed-muted-expected.txt: Added.
* media/audio-playback-restriction-removed-muted.html: Added.
* media/audio-playback-restriction-removed-track-enabled-expected.txt: Added.
* media/audio-playback-restriction-removed-track-enabled.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaElementSessioncpp">trunk/Source/WebCore/html/MediaElementSession.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlMediaElementSessionh">trunk/Source/WebCore/html/MediaElementSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediaaudioplaybackrestrictionremovedmutedexpectedtxt">trunk/LayoutTests/media/audio-playback-restriction-removed-muted-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediaaudioplaybackrestrictionremovedmutedhtml">trunk/LayoutTests/media/audio-playback-restriction-removed-muted.html</a></li>
<li><a href="#trunkLayoutTestsmediaaudioplaybackrestrictionremovedtrackenabledexpectedtxt">trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediaaudioplaybackrestrictionremovedtrackenabledhtml">trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/LayoutTests/ChangeLog        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-06-15  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        [iOS] Make HTMLMediaElement.muted mutable
+        https://bugs.webkit.org/show_bug.cgi?id=158787
+        &lt;rdar://problem/24452567&gt;
+
+        Reviewed by Dean Jackson.
+
+        * media/audio-playback-restriction-removed-muted-expected.txt: Added.
+        * media/audio-playback-restriction-removed-muted.html: Added.
+        * media/audio-playback-restriction-removed-track-enabled-expected.txt: Added.
+        * media/audio-playback-restriction-removed-track-enabled.html: Added.
+
</ins><span class="cx"> 2016-06-15  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         fast/events/ios tests are marked as flakey, but really just fail in OpenSource and WK1
</span></span></pre></div>
<a id="trunkLayoutTestsmediaaudioplaybackrestrictionremovedmutedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/audio-playback-restriction-removed-muted-expected.txt (0 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/audio-playback-restriction-removed-muted-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/audio-playback-restriction-removed-muted-expected.txt        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test that when RequireUserGestureForAudioRateChange is set, setting muted with a user gesture clears the restriction.
+
+
+RUN(internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForAudioRateChange&quot;))
+RUN(video.src = findMediaFile(&quot;audio&quot;, &quot;content/test&quot;))
+EVENT(canplaythrough)
+RUN(video.play())
+EVENT(playing)
+RUN(video.muted = false)
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediaaudioplaybackrestrictionremovedmutedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/audio-playback-restriction-removed-muted.html (0 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/audio-playback-restriction-removed-muted.html                                (rev 0)
+++ trunk/LayoutTests/media/audio-playback-restriction-removed-muted.html        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;audio-playback-restriction&lt;/title&gt;
+    &lt;script src=media-file.js&gt;&lt;/script&gt;
+    &lt;script src=video-test.js&gt;&lt;/script&gt;
+
+    &lt;script&gt;
+    function runTest()
+    {
+        video = document.getElementsByTagName('audio')[0];
+
+        if (window.internals)
+            run('internals.setMediaElementRestrictions(video, &quot;RequireUserGestureForAudioRateChange&quot;)');
+
+        waitForEventAndFail('error');
+        waitForEvent('canplaythrough', canplaythrough);
+        run('video.src = findMediaFile(&quot;audio&quot;, &quot;content/test&quot;)');
+    }    
+
+    function canplaythrough()
+    {
+        waitForEvent('playing', playing);
+        run('video.play()');
+    }
+
+    function playing()
+    {
+        waitForEventAndFail('pause');
+        runWithKeyDown('video.muted = false');
+        setTimeout(endTest, 250);
+    }
+    &lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body onload=&quot;runTest()&quot;&gt;
+    &lt;p&gt;Test that when RequireUserGestureForAudioRateChange is set, setting muted with a user gesture clears the restriction.&lt;/p&gt;
+    &lt;audio muted controls&gt;&lt;/audio&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediaaudioplaybackrestrictionremovedtrackenabledexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled-expected.txt (0 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled-expected.txt        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test that when RequireUserGestureForAudioRateChange is set, enabling an audio track with a user gesture clears the restriction.
+
+
+RUN(internals.setMediaElementRestrictions(video, 'RequireUserGestureForAudioRateChange'))
+RUN(video.src = findMediaFile('video', 'content/audio-tracks'))
+EVENT(canplaythrough)
+RUN(video.play())
+EVENT(playing)
+RUN(audioTrack.enabled = true)
+RUN(video.muted = false)
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediaaudioplaybackrestrictionremovedtrackenabledhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled.html (0 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled.html                                (rev 0)
+++ trunk/LayoutTests/media/audio-playback-restriction-removed-track-enabled.html        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;title&gt;audio-playback-restriction&lt;/title&gt;
+    &lt;script src=media-file.js&gt;&lt;/script&gt;
+    &lt;script src=video-test.js&gt;&lt;/script&gt;
+
+    &lt;script&gt;
+
+    let audioTrack = null;
+    function runTest()
+    {
+        video = document.getElementsByTagName('audio')[0];
+
+        if (window.internals)
+            run(`internals.setMediaElementRestrictions(video, 'RequireUserGestureForAudioRateChange')`);
+
+        waitForEventAndFail('error');
+        waitForEvent('canplaythrough', canplaythrough);
+        run(`video.src = findMediaFile('video', 'content/audio-tracks')`);
+    }    
+
+    function canplaythrough()
+    {
+        waitForEvent('playing', playing);
+        video.audioTracks.addEventListener('change', setMuted, true);
+        run('video.play()');
+    }
+
+    function playing()
+    {
+        for (let i = 0; i &lt; video.audioTracks.length; i++) {
+            if (video.audioTracks[i].enabled)
+                continue;
+
+            audioTrack = video.audioTracks[i];
+            break;
+        }
+        if (audioTrack === null)
+            failTest('Failed to find disabled audio track!');
+
+        runWithKeyDown('audioTrack.enabled = true');
+    }
+    
+    function setMuted()
+    {
+        waitForEventAndFail('pause');
+        video.audioTracks.removeEventListener('change', setMuted, true);
+        run('video.muted = false');
+        setTimeout(endTest, 250);
+    }
+
+    &lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body onload='runTest()'&gt;
+    &lt;p&gt;Test that when RequireUserGestureForAudioRateChange is set, enabling an audio track with a user gesture clears the restriction.&lt;/p&gt;
+    &lt;audio muted controls&gt;&lt;/audio&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/Source/WebCore/ChangeLog        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-06-15  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        [iOS] Make HTMLMediaElement.muted mutable
+        https://bugs.webkit.org/show_bug.cgi?id=158787
+        &lt;rdar://problem/24452567&gt;
+
+        Reviewed by Dean Jackson.
+
+        Tests: media/audio-playback-restriction-removed-muted.html
+               media/audio-playback-restriction-removed-track-enabled.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Remove most behavior restrictions if
+          the track state was changed as a result of a user gesture.
+        (WebCore::HTMLMediaElement::setMuted): Ditto.
+        (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Add mask 
+          parameter so caller can choose which restrictions are removed.
+        * html/HTMLMediaElement.h:
+
+        * html/MediaElementSession.cpp:
+        (WebCore::restrictionName): Drive-by fix: remove duplicate label.
+        * html/MediaElementSession.h:
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Set muted on AVPlayer if setMuted
+          was called before the player was created.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume): Drive-by fix: return early if there
+          is no AVPlayer, not if we won't have metadata yet.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted): New.
+
</ins><span class="cx"> 2016-06-15  Romain Bellessort  &lt;romain.bellessort@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         Enabling Shadow DOM for all platforms
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -1757,6 +1757,8 @@
</span><span class="cx">     ASSERT(track);
</span><span class="cx">     if (m_audioTracks &amp;&amp; m_audioTracks-&gt;contains(*track))
</span><span class="cx">         m_audioTracks-&gt;scheduleChangeEvent();
</span><ins>+    if (ScriptController::processingUserGestureForMedia())
+        removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions &amp; ~MediaElementSession::RequireUserGestureToControlControlsManager);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
</span><span class="lines">@@ -3332,12 +3334,13 @@
</span><span class="cx"> {
</span><span class="cx">     LOG(Media, &quot;HTMLMediaElement::setMuted(%p) - %s&quot;, this, boolString(muted));
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-    UNUSED_PARAM(muted);
-#else
</del><span class="cx">     if (m_muted != muted || !m_explicitlyMuted) {
</span><span class="cx">         m_muted = muted;
</span><span class="cx">         m_explicitlyMuted = true;
</span><ins>+
+        if (ScriptController::processingUserGestureForMedia())
+            removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions &amp; ~MediaElementSession::RequireUserGestureToControlControlsManager);
+
</ins><span class="cx">         // Avoid recursion when the player reports volume changes.
</span><span class="cx">         if (!processingMediaPlayerCallback()) {
</span><span class="cx">             if (m_player) {
</span><span class="lines">@@ -3360,7 +3363,6 @@
</span><span class="cx">         updateMediaState(UpdateMediaState::Asynchronously);
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx">     updatePlaybackControlsManager();
</span><span class="cx"> }
</span><span class="lines">@@ -6401,9 +6403,10 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
</del><ins>+void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask)
</ins><span class="cx"> {
</span><del>-    MediaElementSession::BehaviorRestrictions restrictionsToRemove = MediaElementSession::RequireUserGestureForLoad
</del><ins>+    MediaElementSession::BehaviorRestrictions restrictionsToRemove = mask &amp;
+        (MediaElementSession::RequireUserGestureForLoad
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx">         | MediaElementSession::RequireUserGestureToShowPlaybackTargetPicker
</span><span class="cx">         | MediaElementSession::RequireUserGestureToAutoplayToExternalDevice
</span><span class="lines">@@ -6413,7 +6416,8 @@
</span><span class="cx">         | MediaElementSession::RequireUserGestureForAudioRateChange
</span><span class="cx">         | MediaElementSession::RequireUserGestureForFullscreen
</span><span class="cx">         | MediaElementSession::InvisibleAutoplayNotPermitted
</span><del>-        | MediaElementSession::RequireUserGestureToControlControlsManager;
</del><ins>+        | MediaElementSession::RequireUserGestureToControlControlsManager);
+
</ins><span class="cx">     m_mediaSession-&gt;removeBehaviorRestriction(restrictionsToRemove);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -721,7 +721,7 @@
</span><span class="cx"> 
</span><span class="cx">     void changeNetworkStateFromLoadingToIdle();
</span><span class="cx"> 
</span><del>-    void removeBehaviorsRestrictionsAfterFirstUserGesture();
</del><ins>+    void removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask = MediaElementSession::AllRestrictions);
</ins><span class="cx"> 
</span><span class="cx">     void updateMediaController();
</span><span class="cx">     bool isBlocked() const;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.cpp        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -82,7 +82,6 @@
</span><span class="cx">     CASE(RequireUserGestureToShowPlaybackTargetPicker);
</span><span class="cx">     CASE(WirelessVideoPlaybackDisabled);
</span><span class="cx"> #endif
</span><del>-    CASE(RequireUserGestureForAudioRateChange);
</del><span class="cx">     CASE(InvisibleAutoplayNotPermitted);
</span><span class="cx">     CASE(OverrideUserGestureRequirementForMainContent);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlMediaElementSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/MediaElementSession.h (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/MediaElementSession.h        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/Source/WebCore/html/MediaElementSession.h        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -86,16 +86,15 @@
</span><span class="cx">         RequirePageConsentToLoadMedia = 1 &lt;&lt; 3,
</span><span class="cx">         RequirePageConsentToResumeMedia = 1 &lt;&lt; 4,
</span><span class="cx">         RequireUserGestureForAudioRateChange = 1 &lt;&lt; 5,
</span><del>-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
</del><span class="cx">         RequireUserGestureToShowPlaybackTargetPicker = 1 &lt;&lt; 6,
</span><span class="cx">         WirelessVideoPlaybackDisabled =  1 &lt;&lt; 7,
</span><span class="cx">         RequireUserGestureToAutoplayToExternalDevice = 1 &lt;&lt; 8,
</span><del>-#endif
</del><span class="cx">         MetadataPreloadingNotPermitted = 1 &lt;&lt; 9,
</span><span class="cx">         AutoPreloadingNotPermitted = 1 &lt;&lt; 10,
</span><span class="cx">         InvisibleAutoplayNotPermitted = 1 &lt;&lt; 11,
</span><span class="cx">         OverrideUserGestureRequirementForMainContent = 1 &lt;&lt; 12,
</span><span class="cx">         RequireUserGestureToControlControlsManager = 1 &lt;&lt; 13,
</span><ins>+        AllRestrictions = ~NoRestrictions,
</ins><span class="cx">     };
</span><span class="cx">     typedef unsigned BehaviorRestrictions;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -176,6 +176,8 @@
</span><span class="cx">     void platformPause() override;
</span><span class="cx">     MediaTime currentMediaTime() const override;
</span><span class="cx">     void setVolume(float) override;
</span><ins>+    bool supportsMuting() const override { return true; }
+    void setMuted(bool) override;
</ins><span class="cx">     void setClosedCaptionsVisible(bool) override;
</span><span class="cx">     void paint(GraphicsContext&amp;, const FloatRect&amp;) override;
</span><span class="cx">     void paintCurrentFrameInContext(GraphicsContext&amp;, const FloatRect&amp;) override;
</span><span class="lines">@@ -424,6 +426,7 @@
</span><span class="cx">     bool m_haveBeenAskedToCreateLayer;
</span><span class="cx">     bool m_cachedCanPlayFastForward;
</span><span class="cx">     bool m_cachedCanPlayFastReverse;
</span><ins>+    bool m_muted { false };
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx">     mutable bool m_allowsWirelessVideoPlayback;
</span><span class="cx">     bool m_shouldPlayToPlaybackTarget { false };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (202099 => 202100)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2016-06-15 19:30:23 UTC (rev 202099)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2016-06-15 19:32:50 UTC (rev 202100)
</span><span class="lines">@@ -1058,6 +1058,12 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    if (m_muted) {
+        // Clear m_muted so setMuted doesn't return without doing anything.
+        m_muted = false;
+        [m_avPlayer.get() setMuted:m_muted];
+    }
+
</ins><span class="cx">     if (player()-&gt;client().mediaPlayerIsVideo())
</span><span class="cx">         createAVPlayerLayer();
</span><span class="cx"> 
</span><span class="lines">@@ -1395,13 +1401,28 @@
</span><span class="cx">     UNUSED_PARAM(volume);
</span><span class="cx">     return;
</span><span class="cx"> #else
</span><del>-    if (!metaDataAvailable())
</del><ins>+    if (!m_avPlayer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     [m_avPlayer.get() setVolume:volume];
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MediaPlayerPrivateAVFoundationObjC::setMuted(bool muted)
+{
+    if (m_muted == muted)
+        return;
+
+    LOG(Media, &quot;MediaPlayerPrivateAVFoundationObjC::setMuted(%p) - set to %s&quot;, this, boolString(muted));
+
+    m_muted = muted;
+
+    if (!m_avPlayer)
+        return;
+
+    [m_avPlayer.get() setMuted:m_muted];
+}
+
</ins><span class="cx"> void MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible(bool closedCaptionsVisible)
</span><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(closedCaptionsVisible);
</span></span></pre>
</div>
</div>

</body>
</html>