[Mac][iOS] Adopt MediaRemote "seek to playback position"
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Aug 2016 19:49:02 +0000 (19:49 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Aug 2016 19:49:02 +0000 (19:49 +0000)
commit8732d9cb5bd0295d6803d1f576ea9fc8da1cd3b6
treef653b1a2536302de1723cbd36773ea4f2960c66c
parent33b355943c9d2240763c1d9c397509b61909e649
[Mac][iOS] Adopt MediaRemote "seek to playback position"
https://bugs.webkit.org/show_bug.cgi?id=160405
<rdar://problem/27547583>

Reviewed by Dean Jackson.

Source/WebCore:

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:

LayoutTests:

* media/remote-control-command-seek-expected.txt: Added.
* media/remote-control-command-seek.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203982 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/media/remote-control-command-seek-expected.txt [new file with mode: 0644]
LayoutTests/media/remote-control-command-seek.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioContext.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/RemoteCommandListener.h
Source/WebCore/platform/audio/PlatformMediaSession.cpp
Source/WebCore/platform/audio/PlatformMediaSession.h
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.h
Source/WebCore/platform/ios/RemoteCommandListenerIOS.h
Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm
Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp
Source/WebCore/platform/mac/MediaRemoteSoftLink.h
Source/WebCore/platform/mac/RemoteCommandListenerMac.h
Source/WebCore/platform/mac/RemoteCommandListenerMac.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl