<!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>[206347] branches/safari-602-branch</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/206347">206347</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-09-23 18:18:44 -0700 (Fri, 23 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/203982">r203982</a>. rdar://problem/27547583</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsChangeLog">branches/safari-602-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCoreChangeLog">branches/safari-602-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCoreModuleswebaudioAudioContexth">branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h</a></li>
<li><a href="#branchessafari602branchSourceWebCorehtmlHTMLMediaElementcpp">branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCorehtmlHTMLMediaElementh">branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformRemoteCommandListenerh">branches/safari-602-branch/Source/WebCore/platform/RemoteCommandListener.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessioncpp">branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessionh">branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessionManagercpp">branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessionManagerh">branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformiosRemoteCommandListenerIOSh">branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformiosRemoteCommandListenerIOSmm">branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformmacMediaRemoteSoftLinkcpp">branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformmacMediaRemoteSoftLinkh">branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformmacRemoteCommandListenerMach">branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoreplatformmacRemoteCommandListenerMacmm">branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.mm</a></li>
<li><a href="#branchessafari602branchSourceWebCoretestingInternalscpp">branches/safari-602-branch/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCoretestingInternalsh">branches/safari-602-branch/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#branchessafari602branchSourceWebCoretestingInternalsidl">branches/safari-602-branch/Source/WebCore/testing/Internals.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsmediaremotecontrolcommandseekexpectedtxt">branches/safari-602-branch/LayoutTests/media/remote-control-command-seek-expected.txt</a></li>
<li><a href="#branchessafari602branchLayoutTestsmediaremotecontrolcommandseekhtml">branches/safari-602-branch/LayoutTests/media/remote-control-command-seek.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/LayoutTests/ChangeLog (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/ChangeLog        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/LayoutTests/ChangeLog        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-09-23  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
+        Merge r203982. rdar://problem/27547583
+
+    2016-08-01  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+            [Mac][iOS] Adopt MediaRemote &quot;seek to playback position&quot;
+            https://bugs.webkit.org/show_bug.cgi?id=160405
+            &lt;rdar://problem/27547583&gt;
+
+            Reviewed by Dean Jackson.
+
+            * media/remote-control-command-seek-expected.txt: Added.
+            * media/remote-control-command-seek.html: Added.
+
</ins><span class="cx"> 2016-09-14  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r205870. rdar://problem/28225774
</span></span></pre></div>
<a id="branchessafari602branchLayoutTestsmediaremotecontrolcommandseekexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/media/remote-control-command-seek-expected.txt (0 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/media/remote-control-command-seek-expected.txt                                (rev 0)
+++ branches/safari-602-branch/LayoutTests/media/remote-control-command-seek-expected.txt        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test that the &quot;seekToPlaybackPosition&quot; remote control command works.
+
+
+* set video.src
+EVENT(loadedmetadata)
+
+* Send a seek command.
+RUN(internals.postRemoteControlCommand('seekToPlaybackPosition', 1.6))
+
+EVENT(timeupdate)
+EXPECTED (video.currentTime.toFixed(1) == '1.6') OK
+
+END OF TEST
+
</ins></span></pre></div>
<a id="branchessafari602branchLayoutTestsmediaremotecontrolcommandseekhtml"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/media/remote-control-command-seek.html (0 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/media/remote-control-command-seek.html                                (rev 0)
+++ branches/safari-602-branch/LayoutTests/media/remote-control-command-seek.html        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=&quot;media-file.js&quot;&gt;&lt;/script&gt;
+        &lt;script src=&quot;video-test.js&quot;&gt;&lt;/script&gt;
+        &lt;script&gt;
+
+            function start()
+            {
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
+
+                findMediaElement();
+
+                waitForEvent('loadedmetadata', loadedmetadata, false, true, document)
+                waitForEvent('timeupdate', seeked)
+
+                consoleWrite('* set video.src');
+                video.src = findMediaFile('video', 'content/test');
+            }
+
+            function loadedmetadata()
+            {
+                consoleWrite('&lt;br&gt;* Send a seek command.');
+                run(&quot;internals.postRemoteControlCommand('seekToPlaybackPosition', 1.6)&quot;);
+                consoleWrite('');
+            }
+
+            function seeked()
+            {
+                testExpected('video.currentTime.toFixed(1)', 1.6);
+                consoleWrite(&quot;&quot;);
+                endTest();
+            }
+
+        &lt;/script&gt;
+    &lt;/head&gt;
+
+    &lt;body onload=&quot;start()&quot;&gt;
+        &lt;p&gt;Test that the &quot;seekToPlaybackPosition&quot; remote control command works.&lt;/p&gt;
+        &lt;video controls&gt;&lt;/video&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="branchessafari602branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/ChangeLog        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -1,5 +1,70 @@
</span><span class="cx"> 2016-09-23  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r203982. rdar://problem/27547583
+
+    2016-08-01  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+            [Mac][iOS] Adopt MediaRemote &quot;seek to playback position&quot;
+            https://bugs.webkit.org/show_bug.cgi?id=160405
+            &lt;rdar://problem/27547583&gt;
+
+            Reviewed by Dean Jackson.
+
+            Test: media/remote-control-command-seek.html
+
+            * Modules/webaudio/AudioContext.h: Update for didReceiveRemoteControlCommand argument change.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Support SeekToPlaybackPositionCommand.
+            Drive by fix, support Stop command.
+            (WebCore::HTMLMediaElement::supportsSeeking): New.
+            * html/HTMLMediaElement.h:
+
+            * platform/RemoteCommandListener.h:
+            (WebCore::RemoteCommandListenerClient::didReceiveRemoteControlCommand): Add command argument.
+            (WebCore::RemoteCommandListenerClient::supportsSeeking): New.
+            (WebCore::RemoteCommandListener::updateSupportedCommands): Ditto.
+            (WebCore::RemoteCommandListener::client): Ditto.
+
+            * platform/audio/PlatformMediaSession.cpp:
+            (WebCore::PlatformMediaSession::didReceiveRemoteControlCommand): Add command argument.
+            (WebCore::PlatformMediaSession::supportsSeeking): New, pass through to client.
+            * platform/audio/PlatformMediaSession.h:
+
+            * platform/audio/PlatformMediaSessionManager.cpp:
+            (WebCore::PlatformMediaSessionManager::setCurrentSession): Tell remote command listener to
+            update supported commands.
+            (WebCore::PlatformMediaSessionManager::currentSession): Make const.
+            (WebCore::PlatformMediaSessionManager::didReceiveRemoteControlCommand): Add command argument.
+            (WebCore::PlatformMediaSessionManager::supportsSeeking): New, pass through to session.
+            * platform/audio/PlatformMediaSessionManager.h:
+
+            * platform/ios/RemoteCommandListenerIOS.h:
+            (WebCore::RemoteCommandListenerIOS::createWeakPtr):
+            * platform/ios/RemoteCommandListenerIOS.mm:
+            (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS): Support changePlaybackPositionCommand.
+            (WebCore::RemoteCommandListenerIOS::~RemoteCommandListenerIOS): Remove seekToTime target.
+            (WebCore::RemoteCommandListenerIOS::updateSupportedCommands): Update changePlaybackPositionCommand.
+
+            * platform/mac/MediaRemoteSoftLink.cpp:
+            * platform/mac/MediaRemoteSoftLink.h:
+
+            * platform/mac/RemoteCommandListenerMac.h:
+            * platform/mac/RemoteCommandListenerMac.mm:
+            (WebCore::RemoteCommandListenerMac::updateSupportedCommands): New, split out of constructor.
+            (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Split setup logic out into
+            updateSupportedCommands. Support MRMediaRemoteCommandSeekToPlaybackPosition. Don't assert when
+            receiving an unsupported command, it happens. Return error when a command isn't supported or
+            fails.
+
+            * testing/Internals.cpp:
+            (WebCore::Internals::postRemoteControlCommand): Add command argument parameter. Support
+            seektoplaybackposition.
+            * testing/Internals.h:
+            * testing/Internals.idl:
+
+2016-09-23  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r206315. rdar://problem/28430615
</span><span class="cx"> 
</span><span class="cx">     2016-09-23  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreModuleswebaudioAudioContexth"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -314,7 +314,8 @@
</span><span class="cx">     void mayResumePlayback(bool shouldResume) override;
</span><span class="cx">     void suspendPlayback() override;
</span><span class="cx">     bool canReceiveRemoteControlCommands() const override { return false; }
</span><del>-    void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override { }
</del><ins>+    void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) override { }
+    bool supportsSeeking() const override { return false; }
</ins><span class="cx">     bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override { return false; }
</span><span class="cx">     String sourceApplicationIdentifier() const override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -6960,7 +6960,7 @@
</span><span class="cx">     return m_currentSrc;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLMediaElement::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command)
</del><ins>+void HTMLMediaElement::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument)
</ins><span class="cx"> {
</span><span class="cx">     LOG(Media, &quot;HTMLMediaElement::didReceiveRemoteControlCommand(%p) - %i&quot;, this, static_cast&lt;int&gt;(command));
</span><span class="cx"> 
</span><span class="lines">@@ -6969,6 +6969,7 @@
</span><span class="cx">     case PlatformMediaSession::PlayCommand:
</span><span class="cx">         play();
</span><span class="cx">         break;
</span><ins>+    case PlatformMediaSession::StopCommand:
</ins><span class="cx">     case PlatformMediaSession::PauseCommand:
</span><span class="cx">         pause();
</span><span class="cx">         break;
</span><span class="lines">@@ -6985,11 +6986,21 @@
</span><span class="cx">     case PlatformMediaSession::EndSeekingForwardCommand:
</span><span class="cx">         endScanning();
</span><span class="cx">         break;
</span><ins>+    case PlatformMediaSession::SeekToPlaybackPositionCommand:
+        ASSERT(argument);
+        if (argument)
+            fastSeek(argument-&gt;asDouble);
+        break;
</ins><span class="cx">     default:
</span><span class="cx">         { } // Do nothing
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLMediaElement::supportsSeeking() const 
+{
+    return !isLiveStream();
+}
+
</ins><span class="cx"> bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const
</span><span class="cx"> {
</span><span class="cx">     if (type == PlatformMediaSession::EnteringBackground) {
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -627,7 +627,7 @@
</span><span class="cx">     void mediaPlayerActiveSourceBuffersChanged(const MediaPlayer*) override;
</span><span class="cx"> 
</span><span class="cx">     bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&amp;) override;
</span><del>-    void mediaPlayerHandlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType command) override { didReceiveRemoteControlCommand(command); }
</del><ins>+    void mediaPlayerHandlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType command) override { didReceiveRemoteControlCommand(command, nullptr); }
</ins><span class="cx">     String sourceApplicationIdentifier() const override;
</span><span class="cx">     String mediaPlayerSourceApplicationIdentifier() const override { return sourceApplicationIdentifier(); }
</span><span class="cx">     Vector&lt;String&gt; mediaPlayerPreferredAudioCharacteristics() const override;
</span><span class="lines">@@ -769,7 +769,8 @@
</span><span class="cx">     double mediaSessionDuration() const override { return duration(); }
</span><span class="cx">     double mediaSessionCurrentTime() const override { return currentTime(); }
</span><span class="cx">     bool canReceiveRemoteControlCommands() const override { return true; }
</span><del>-    void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override;
</del><ins>+    void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) override;
+    bool supportsSeeking() const override;
</ins><span class="cx">     bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override;
</span><span class="cx">     bool shouldOverrideBackgroundLoadingRestriction() const override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformRemoteCommandListenerh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/RemoteCommandListener.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/RemoteCommandListener.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/RemoteCommandListener.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -34,7 +34,8 @@
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     virtual ~RemoteCommandListenerClient() { }
</span><del>-    virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) = 0;
</del><ins>+    virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) = 0;
+    virtual bool supportsSeeking() const = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class RemoteCommandListener {
</span><span class="lines">@@ -43,6 +44,10 @@
</span><span class="cx">     RemoteCommandListener(RemoteCommandListenerClient&amp; client) : m_client(client) { }
</span><span class="cx">     virtual ~RemoteCommandListener() { }
</span><span class="cx"> 
</span><ins>+    virtual void updateSupportedCommands() { }
+
+    RemoteCommandListenerClient&amp; client() const { return m_client; }
+
</ins><span class="cx"> protected:
</span><span class="cx">     RemoteCommandListenerClient&amp; m_client;
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -242,11 +242,16 @@
</span><span class="cx">     return m_client.canReceiveRemoteControlCommands();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PlatformMediaSession::didReceiveRemoteControlCommand(RemoteControlCommandType command)
</del><ins>+void PlatformMediaSession::didReceiveRemoteControlCommand(RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument)
</ins><span class="cx"> {
</span><del>-    m_client.didReceiveRemoteControlCommand(command);
</del><ins>+    m_client.didReceiveRemoteControlCommand(command, argument);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool PlatformMediaSession::supportsSeeking() const
+{
+    return m_client.supportsSeeking();
+}
+
</ins><span class="cx"> void PlatformMediaSession::visibilityChanged()
</span><span class="cx"> {
</span><span class="cx">     scheduleClientDataBufferingCheck();
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessionh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -114,6 +114,10 @@
</span><span class="cx">     double currentTime() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    typedef union {
+        double asDouble;
+    } RemoteCommandArgument;
+
</ins><span class="cx">     enum RemoteControlCommandType {
</span><span class="cx">         NoCommand,
</span><span class="cx">         PlayCommand,
</span><span class="lines">@@ -124,9 +128,11 @@
</span><span class="cx">         EndSeekingBackwardCommand,
</span><span class="cx">         BeginSeekingForwardCommand,
</span><span class="cx">         EndSeekingForwardCommand,
</span><ins>+        SeekToPlaybackPositionCommand,
</ins><span class="cx">     };
</span><span class="cx">     bool canReceiveRemoteControlCommands() const;
</span><del>-    void didReceiveRemoteControlCommand(RemoteControlCommandType);
</del><ins>+    void didReceiveRemoteControlCommand(RemoteControlCommandType, const RemoteCommandArgument* argument = nullptr);
+    bool supportsSeeking() const;
</ins><span class="cx"> 
</span><span class="cx">     enum DisplayType {
</span><span class="cx">         Normal,
</span><span class="lines">@@ -203,7 +209,8 @@
</span><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx">     virtual bool canReceiveRemoteControlCommands() const = 0;
</span><del>-    virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) = 0;
</del><ins>+    virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) = 0;
+    virtual bool supportsSeeking() const = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void setShouldBufferData(bool) { }
</span><span class="cx">     virtual bool elementIsHidden() const { return false; }
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessionManagercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -274,11 +274,13 @@
</span><span class="cx"> 
</span><span class="cx">     m_sessions.remove(index);
</span><span class="cx">     m_sessions.insert(0, &amp;session);
</span><ins>+    if (m_remoteCommandListener)
+        m_remoteCommandListener-&gt;updateSupportedCommands();
</ins><span class="cx">     
</span><span class="cx">     LOG(Media, &quot;PlatformMediaSessionManager::setCurrentSession - session moved from index %zu to 0&quot;, index);
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-PlatformMediaSession* PlatformMediaSessionManager::currentSession()
</del><ins>+PlatformMediaSession* PlatformMediaSessionManager::currentSession() const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_sessions.size())
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -353,14 +355,22 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void PlatformMediaSessionManager::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command)
</del><ins>+void PlatformMediaSessionManager::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument)
</ins><span class="cx"> {
</span><span class="cx">     PlatformMediaSession* activeSession = currentSession();
</span><span class="cx">     if (!activeSession || !activeSession-&gt;canReceiveRemoteControlCommands())
</span><span class="cx">         return;
</span><del>-    activeSession-&gt;didReceiveRemoteControlCommand(command);
</del><ins>+    activeSession-&gt;didReceiveRemoteControlCommand(command, argument);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool PlatformMediaSessionManager::supportsSeeking() const
+{
+    PlatformMediaSession* activeSession = currentSession();
+    if (!activeSession)
+        return false;
+    return activeSession-&gt;supportsSeeking();
+}
+
</ins><span class="cx"> void PlatformMediaSessionManager::systemWillSleep()
</span><span class="cx"> {
</span><span class="cx">     if (m_interrupted)
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformaudioPlatformMediaSessionManagerh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void setCurrentSession(PlatformMediaSession&amp;);
</span><del>-    PlatformMediaSession* currentSession();
</del><ins>+    PlatformMediaSession* currentSession() const;
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;PlatformMediaSession*&gt; currentSessionsMatching(std::function&lt;bool(const PlatformMediaSession&amp;)&gt;);
</span><span class="cx"> 
</span><span class="lines">@@ -115,7 +115,8 @@
</span><span class="cx">     void updateSessionState();
</span><span class="cx"> 
</span><span class="cx">     // RemoteCommandListenerClient
</span><del>-    WEBCORE_EXPORT void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override;
</del><ins>+    WEBCORE_EXPORT void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) override;
+    WEBCORE_EXPORT bool supportsSeeking() const override;
</ins><span class="cx"> 
</span><span class="cx">     // AudioHardwareListenerClient
</span><span class="cx">     void audioHardwareDidBecomeActive() override { }
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformiosRemoteCommandListenerIOSh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -46,7 +46,8 @@
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     WeakPtr&lt;RemoteCommandListenerIOS&gt; createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
</span><del>-    
</del><ins>+    void updateSupportedCommands() override;
+
</ins><span class="cx">     WeakPtrFactory&lt;RemoteCommandListenerIOS&gt; m_weakPtrFactory;
</span><span class="cx">     RetainPtr&lt;id&gt; m_playTarget;
</span><span class="cx">     RetainPtr&lt;id&gt; m_pauseTarget;
</span><span class="lines">@@ -53,6 +54,7 @@
</span><span class="cx">     RetainPtr&lt;id&gt; m_togglePlayPauseTarget;
</span><span class="cx">     RetainPtr&lt;id&gt; m_seekForwardTarget;
</span><span class="cx">     RetainPtr&lt;id&gt; m_seekBackwardTarget;
</span><ins>+    RetainPtr&lt;id&gt; m_seekToTimeTarget;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformiosRemoteCommandListenerIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -36,6 +36,9 @@
</span><span class="cx"> SOFT_LINK_FRAMEWORK(MediaPlayer)
</span><span class="cx"> SOFT_LINK_CLASS(MediaPlayer, MPRemoteCommandCenter)
</span><span class="cx"> SOFT_LINK_CLASS(MediaPlayer, MPSeekCommandEvent)
</span><ins>+#if __IPHONE_OS_VERSION_MAX_ALLOWED &gt;= 90100
+SOFT_LINK_CLASS(MediaPlayer, MPChangePlaybackPositionCommandEvent)
+#endif
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -55,7 +58,7 @@
</span><span class="cx">         callOnMainThread([weakThis] {
</span><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span><del>-            weakThis-&gt;m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PauseCommand);
</del><ins>+            weakThis-&gt;m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PauseCommand, nullptr);
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         return MPRemoteCommandHandlerStatusSuccess;
</span><span class="lines">@@ -65,7 +68,7 @@
</span><span class="cx">         callOnMainThread([weakThis] {
</span><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span><del>-            weakThis-&gt;m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PlayCommand);
</del><ins>+            weakThis-&gt;m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PlayCommand, nullptr);
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         return MPRemoteCommandHandlerStatusSuccess;
</span><span class="lines">@@ -75,7 +78,7 @@
</span><span class="cx">         callOnMainThread([weakThis] {
</span><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span><del>-            weakThis-&gt;m_client.didReceiveRemoteControlCommand(PlatformMediaSession::TogglePlayPauseCommand);
</del><ins>+            weakThis-&gt;m_client.didReceiveRemoteControlCommand(PlatformMediaSession::TogglePlayPauseCommand, nullptr);
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         return MPRemoteCommandHandlerStatusSuccess;
</span><span class="lines">@@ -90,7 +93,7 @@
</span><span class="cx">         callOnMainThread([weakThis, command] {
</span><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span><del>-            weakThis-&gt;m_client.didReceiveRemoteControlCommand(command);
</del><ins>+            weakThis-&gt;m_client.didReceiveRemoteControlCommand(command, nullptr);
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         return MPRemoteCommandHandlerStatusSuccess;
</span><span class="lines">@@ -105,11 +108,31 @@
</span><span class="cx">         callOnMainThread([weakThis, command] {
</span><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span><del>-            weakThis-&gt;m_client.didReceiveRemoteControlCommand(command);
</del><ins>+            weakThis-&gt;m_client.didReceiveRemoteControlCommand(command, nullptr);
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         return MPRemoteCommandHandlerStatusSuccess;
</span><span class="cx">     }];
</span><ins>+
+#if __IPHONE_OS_VERSION_MAX_ALLOWED &gt;= 90100
+    m_seekToTimeTarget = [[center changePlaybackPositionCommand] addTargetWithHandler:^(MPRemoteCommandEvent *event) {
+        ASSERT([event isKindOfClass:getMPChangePlaybackPositionCommandEventClass()]);
+
+        if (!client.supportsSeeking())
+            return MPRemoteCommandHandlerStatusCommandFailed;
+
+        MPChangePlaybackPositionCommandEvent* seekEvent = static_cast&lt;MPChangePlaybackPositionCommandEvent *&gt;(event);
+        PlatformMediaSession::RemoteCommandArgument argument { [seekEvent positionTime] };
+
+        callOnMainThread([weakThis, argument] {
+            if (!weakThis)
+                return;
+            weakThis-&gt;m_client.didReceiveRemoteControlCommand(PlatformMediaSession::TogglePlayPauseCommand, &amp;argument);
+        });
+
+        return MPRemoteCommandHandlerStatusSuccess;
+    }];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RemoteCommandListenerIOS::~RemoteCommandListenerIOS()
</span><span class="lines">@@ -120,8 +143,18 @@
</span><span class="cx">     [[center togglePlayPauseCommand] removeTarget:m_togglePlayPauseTarget.get()];
</span><span class="cx">     [[center seekForwardCommand] removeTarget:m_seekForwardTarget.get()];
</span><span class="cx">     [[center seekBackwardCommand] removeTarget:m_seekBackwardTarget.get()];
</span><ins>+#if __IPHONE_OS_VERSION_MAX_ALLOWED &gt;= 90100
+    [[center changePlaybackPositionCommand] removeTarget:m_seekToTimeTarget.get()];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RemoteCommandListenerIOS::updateSupportedCommands()
+{
+#if __IPHONE_OS_VERSION_MAX_ALLOWED &gt;= 90100
+    [[[getMPRemoteCommandCenterClass() sharedCommandCenter] changePlaybackPositionCommand] setEnabled:!!client().supportsSeeking()];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformmacMediaRemoteSoftLinkcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -47,5 +47,6 @@
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoDuration, CFStringRef);
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoElapsedTime, CFStringRef);
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoPlaybackRate, CFStringRef);
</span><ins>+SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteOptionPlaybackPosition, CFStringRef);
</ins><span class="cx"> 
</span><span class="cx"> #endif // USE(MEDIAREMOTE)
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformmacMediaRemoteSoftLinkh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -63,5 +63,7 @@
</span><span class="cx"> #define kMRMediaRemoteNowPlayingInfoElapsedTime get_MediaRemote_kMRMediaRemoteNowPlayingInfoElapsedTime()
</span><span class="cx"> SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoPlaybackRate, CFStringRef);
</span><span class="cx"> #define kMRMediaRemoteNowPlayingInfoPlaybackRate get_MediaRemote_kMRMediaRemoteNowPlayingInfoPlaybackRate()
</span><ins>+SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteOptionPlaybackPosition, CFStringRef);
+#define kMRMediaRemoteOptionPlaybackPosition get_MediaRemote_kMRMediaRemoteOptionPlaybackPosition()
</ins><span class="cx"> 
</span><span class="cx"> #endif // USE(MEDIAREMOTE)
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformmacRemoteCommandListenerMach"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -42,6 +42,8 @@
</span><span class="cx"> protected:
</span><span class="cx">     WeakPtr&lt;RemoteCommandListenerMac&gt; createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
</span><span class="cx"> 
</span><ins>+    void updateSupportedCommands() override;
+
</ins><span class="cx">     WeakPtrFactory&lt;RemoteCommandListenerMac&gt; m_weakPtrFactory { this };
</span><span class="cx">     void* m_commandHandler { nullptr };
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreplatformmacRemoteCommandListenerMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.mm (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.mm        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.mm        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -40,8 +40,7 @@
</span><span class="cx">     return std::make_unique&lt;RemoteCommandListenerMac&gt;(client);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RemoteCommandListenerMac::RemoteCommandListenerMac(RemoteCommandListenerClient&amp; client)
-    : RemoteCommandListener(client)
</del><ins>+void RemoteCommandListenerMac::updateSupportedCommands()
</ins><span class="cx"> {
</span><span class="cx"> #if USE(MEDIAREMOTE)
</span><span class="cx">     if (!isMediaRemoteFrameworkAvailable())
</span><span class="lines">@@ -66,13 +65,32 @@
</span><span class="cx">         CFArrayAppendValue(commandInfoArray.get(), commandInfo.get());
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    auto seekCommandInfo = adoptCF(MRMediaRemoteCommandInfoCreate(kCFAllocatorDefault));
+    MRMediaRemoteCommandInfoSetCommand(seekCommandInfo.get(), MRMediaRemoteCommandSeekToPlaybackPosition);
+    MRMediaRemoteCommandInfoSetEnabled(seekCommandInfo.get(), client().supportsSeeking());
+    CFArrayAppendValue(commandInfoArray.get(), seekCommandInfo.get());
+
</ins><span class="cx">     MRMediaRemoteSetSupportedCommands(commandInfoArray.get(), MRMediaRemoteGetLocalOrigin(), nullptr, nullptr);
</span><ins>+#endif // USE(MEDIAREMOTE)
+}
</ins><span class="cx"> 
</span><ins>+RemoteCommandListenerMac::RemoteCommandListenerMac(RemoteCommandListenerClient&amp; client)
+    : RemoteCommandListener(client)
+{
+#if USE(MEDIAREMOTE)
+    if (!isMediaRemoteFrameworkAvailable())
+        return;
+
+    updateSupportedCommands();
+
</ins><span class="cx">     auto weakThis = createWeakPtr();
</span><span class="cx">     m_commandHandler = MRMediaRemoteAddAsyncCommandHandlerBlock(^(MRMediaRemoteCommand command, CFDictionaryRef options, void(^completion)(CFArrayRef)) {
</span><del>-        UNUSED_PARAM(options);
</del><span class="cx"> 
</span><ins>+        LOG(Media, &quot;RemoteCommandListenerMac::RemoteCommandListenerMac - received command %u&quot;, command);
+
</ins><span class="cx">         PlatformMediaSession::RemoteControlCommandType platformCommand { PlatformMediaSession::NoCommand };
</span><ins>+        PlatformMediaSession::RemoteCommandArgument argument { 0 };
+        MRMediaRemoteCommandHandlerStatus status = MRMediaRemoteCommandHandlerStatusSuccess;
</ins><span class="cx"> 
</span><span class="cx">         switch (command) {
</span><span class="cx">         case MRMediaRemoteCommandPlay:
</span><span class="lines">@@ -81,6 +99,9 @@
</span><span class="cx">         case MRMediaRemoteCommandPause:
</span><span class="cx">             platformCommand = PlatformMediaSession::PauseCommand;
</span><span class="cx">             break;
</span><ins>+        case MRMediaRemoteCommandStop:
+            platformCommand = PlatformMediaSession::StopCommand;
+            break;
</ins><span class="cx">         case MRMediaRemoteCommandTogglePlayPause:
</span><span class="cx">             platformCommand = PlatformMediaSession::TogglePlayPauseCommand;
</span><span class="cx">             break;
</span><span class="lines">@@ -96,14 +117,32 @@
</span><span class="cx">         case MRMediaRemoteCommandEndRewind:
</span><span class="cx">             platformCommand = PlatformMediaSession::EndSeekingBackwardCommand;
</span><span class="cx">             break;
</span><ins>+        case MRMediaRemoteCommandSeekToPlaybackPosition: {
+            if (!client.supportsSeeking()) {
+                status = MRMediaRemoteCommandHandlerStatusCommandFailed;
+                break;
+            }
+
+            CFNumberRef positionRef = static_cast&lt;CFNumberRef&gt;(CFDictionaryGetValue(options, kMRMediaRemoteOptionPlaybackPosition));
+            if (!positionRef) {
+                status = MRMediaRemoteCommandHandlerStatusCommandFailed;
+                break;
+            }
+
+            CFNumberGetValue(positionRef, kCFNumberDoubleType, &amp;argument.asDouble);
+            platformCommand = PlatformMediaSession::SeekToPlaybackPositionCommand;
+            break;
+        }
</ins><span class="cx">         default:
</span><del>-            ASSERT_NOT_REACHED();
</del><ins>+            LOG(Media, &quot;RemoteCommandListenerMac::RemoteCommandListenerMac - command %u not supported!&quot;, command);
+            status = MRMediaRemoteCommandHandlerStatusCommandFailed;
+            return;
</ins><span class="cx">         };
</span><span class="cx"> 
</span><span class="cx">         if (!weakThis)
</span><span class="cx">             return;
</span><del>-        weakThis-&gt;m_client.didReceiveRemoteControlCommand(platformCommand);
-        completion(static_cast&lt;CFArrayRef&gt;(@[@0]));
</del><ins>+        weakThis-&gt;m_client.didReceiveRemoteControlCommand(platformCommand, &amp;argument);
+        completion(static_cast&lt;CFArrayRef&gt;(@[@(status)]));
</ins><span class="cx">     });
</span><span class="cx"> #endif // USE(MEDIAREMOTE)
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/testing/Internals.cpp (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/testing/Internals.cpp        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/testing/Internals.cpp        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -2862,10 +2862,11 @@
</span><span class="cx">     element.mediaSession().addBehaviorRestriction(restrictions);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Internals::postRemoteControlCommand(const String&amp; commandString, ExceptionCode&amp; ec)
</del><ins>+void Internals::postRemoteControlCommand(const String&amp; commandString, float argument, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     PlatformMediaSession::RemoteControlCommandType command;
</span><del>-    
</del><ins>+    PlatformMediaSession::RemoteCommandArgument parameter { argument };
+
</ins><span class="cx">     if (equalLettersIgnoringASCIICase(commandString, &quot;play&quot;))
</span><span class="cx">         command = PlatformMediaSession::PlayCommand;
</span><span class="cx">     else if (equalLettersIgnoringASCIICase(commandString, &quot;pause&quot;))
</span><span class="lines">@@ -2882,12 +2883,14 @@
</span><span class="cx">         command = PlatformMediaSession::BeginSeekingForwardCommand;
</span><span class="cx">     else if (equalLettersIgnoringASCIICase(commandString, &quot;endseekingforward&quot;))
</span><span class="cx">         command = PlatformMediaSession::EndSeekingForwardCommand;
</span><ins>+    else if (equalLettersIgnoringASCIICase(commandString, &quot;seektoplaybackposition&quot;))
+        command = PlatformMediaSession::SeekToPlaybackPositionCommand;
</ins><span class="cx">     else {
</span><span class="cx">         ec = INVALID_ACCESS_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    PlatformMediaSessionManager::sharedManager().didReceiveRemoteControlCommand(command);
</del><ins>+    PlatformMediaSessionManager::sharedManager().didReceiveRemoteControlCommand(command, &amp;parameter);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool Internals::elementIsBlockingDisplaySleep(HTMLMediaElement&amp; element) const
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/testing/Internals.h (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/testing/Internals.h        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/testing/Internals.h        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -407,7 +407,7 @@
</span><span class="cx">     void applicationWillEnterBackground() const;
</span><span class="cx">     void setMediaSessionRestrictions(const String&amp; mediaType, const String&amp; restrictions, ExceptionCode&amp;);
</span><span class="cx">     void setMediaElementRestrictions(HTMLMediaElement&amp;, const String&amp; restrictions);
</span><del>-    void postRemoteControlCommand(const String&amp;, ExceptionCode&amp;);
</del><ins>+    void postRemoteControlCommand(const String&amp;, float argument, ExceptionCode&amp;);
</ins><span class="cx">     bool elementIsBlockingDisplaySleep(HTMLMediaElement&amp;) const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/testing/Internals.idl (206346 => 206347)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/testing/Internals.idl        2016-09-24 01:17:09 UTC (rev 206346)
+++ branches/safari-602-branch/Source/WebCore/testing/Internals.idl        2016-09-24 01:18:44 UTC (rev 206347)
</span><span class="lines">@@ -402,7 +402,7 @@
</span><span class="cx">     [Conditional=VIDEO, RaisesException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions);
</span><span class="cx">     [Conditional=VIDEO] void setMediaElementRestrictions(HTMLMediaElement element, DOMString restrictions);
</span><span class="cx">     [Conditional=WEB_AUDIO] void setAudioContextRestrictions(AudioContext context, DOMString restrictions);
</span><del>-    [Conditional=VIDEO, RaisesException] void postRemoteControlCommand(DOMString command);
</del><ins>+    [Conditional=VIDEO, RaisesException] void postRemoteControlCommand(DOMString command, optional unrestricted float argument = 0);
</ins><span class="cx">     [Conditional=WIRELESS_PLAYBACK_TARGET] void setMockMediaPlaybackTargetPickerEnabled(boolean enabled);
</span><span class="cx">     [Conditional=WIRELESS_PLAYBACK_TARGET, RaisesException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState);
</span><span class="cx">     [Conditional=MEDIA_STREAM] void setMockMediaCaptureDevicesEnabled(boolean enabled);
</span></span></pre>
</div>
</div>

</body>
</html>