Changeset 204068 in webkit
- Timestamp:
- Aug 2, 2016, 11:15:54 PM (10 years ago)
- Location:
- branches/safari-602-branch
- Files:
-
- 2 added
- 19 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/media/remote-control-command-seek-expected.txt (added)
-
LayoutTests/media/remote-control-command-seek.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioContext.h (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (3 diffs)
-
Source/WebCore/html/HTMLMediaElement.h (modified) (2 diffs)
-
Source/WebCore/platform/RemoteCommandListener.h (modified) (2 diffs)
-
Source/WebCore/platform/audio/PlatformMediaSession.cpp (modified) (1 diff)
-
Source/WebCore/platform/audio/PlatformMediaSession.h (modified) (3 diffs)
-
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (modified) (2 diffs)
-
Source/WebCore/platform/audio/PlatformMediaSessionManager.h (modified) (2 diffs)
-
Source/WebCore/platform/ios/RemoteCommandListenerIOS.h (modified) (2 diffs)
-
Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm (modified) (7 diffs)
-
Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp (modified) (1 diff)
-
Source/WebCore/platform/mac/MediaRemoteSoftLink.h (modified) (1 diff)
-
Source/WebCore/platform/mac/RemoteCommandListenerMac.h (modified) (1 diff)
-
Source/WebCore/platform/mac/RemoteCommandListenerMac.mm (modified) (4 diffs)
-
Source/WebCore/testing/Internals.cpp (modified) (3 diffs)
-
Source/WebCore/testing/Internals.h (modified) (1 diff)
-
Source/WebCore/testing/Internals.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-602-branch/LayoutTests/ChangeLog
r204056 r204068 1 2016-08-02 Babak Shafiei <bshafiei@apple.com> 2 3 Merge r203982. rdar://problem/27547583 4 5 2016-08-01 Eric Carlson <eric.carlson@apple.com> 6 7 [Mac][iOS] Adopt MediaRemote "seek to playback position" 8 https://bugs.webkit.org/show_bug.cgi?id=160405 9 <rdar://problem/27547583> 10 11 Reviewed by Dean Jackson. 12 13 * media/remote-control-command-seek-expected.txt: Added. 14 * media/remote-control-command-seek.html: Added. 15 1 16 2016-08-02 Ryan Haddad <ryanhaddad@apple.com> 2 17 -
branches/safari-602-branch/Source/WebCore/ChangeLog
r204015 r204068 1 2016-08-02 Babak Shafiei <bshafiei@apple.com> 2 3 Merge r203982. rdar://problem/27547583 4 5 2016-08-01 Eric Carlson <eric.carlson@apple.com> 6 7 [Mac][iOS] Adopt MediaRemote "seek to playback position" 8 https://bugs.webkit.org/show_bug.cgi?id=160405 9 <rdar://problem/27547583> 10 11 Reviewed by Dean Jackson. 12 13 Test: media/remote-control-command-seek.html 14 15 * Modules/webaudio/AudioContext.h: Update for didReceiveRemoteControlCommand argument change. 16 17 * html/HTMLMediaElement.cpp: 18 (WebCore::HTMLMediaElement::didReceiveRemoteControlCommand): Support SeekToPlaybackPositionCommand. 19 Drive by fix, support Stop command. 20 (WebCore::HTMLMediaElement::supportsSeeking): New. 21 * html/HTMLMediaElement.h: 22 23 * platform/RemoteCommandListener.h: 24 (WebCore::RemoteCommandListenerClient::didReceiveRemoteControlCommand): Add command argument. 25 (WebCore::RemoteCommandListenerClient::supportsSeeking): New. 26 (WebCore::RemoteCommandListener::updateSupportedCommands): Ditto. 27 (WebCore::RemoteCommandListener::client): Ditto. 28 29 * platform/audio/PlatformMediaSession.cpp: 30 (WebCore::PlatformMediaSession::didReceiveRemoteControlCommand): Add command argument. 31 (WebCore::PlatformMediaSession::supportsSeeking): New, pass through to client. 32 * platform/audio/PlatformMediaSession.h: 33 34 * platform/audio/PlatformMediaSessionManager.cpp: 35 (WebCore::PlatformMediaSessionManager::setCurrentSession): Tell remote command listener to 36 update supported commands. 37 (WebCore::PlatformMediaSessionManager::currentSession): Make const. 38 (WebCore::PlatformMediaSessionManager::didReceiveRemoteControlCommand): Add command argument. 39 (WebCore::PlatformMediaSessionManager::supportsSeeking): New, pass through to session. 40 * platform/audio/PlatformMediaSessionManager.h: 41 42 * platform/ios/RemoteCommandListenerIOS.h: 43 (WebCore::RemoteCommandListenerIOS::createWeakPtr): 44 * platform/ios/RemoteCommandListenerIOS.mm: 45 (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS): Support changePlaybackPositionCommand. 46 (WebCore::RemoteCommandListenerIOS::~RemoteCommandListenerIOS): Remove seekToTime target. 47 (WebCore::RemoteCommandListenerIOS::updateSupportedCommands): Update changePlaybackPositionCommand. 48 49 * platform/mac/MediaRemoteSoftLink.cpp: 50 * platform/mac/MediaRemoteSoftLink.h: 51 52 * platform/mac/RemoteCommandListenerMac.h: 53 * platform/mac/RemoteCommandListenerMac.mm: 54 (WebCore::RemoteCommandListenerMac::updateSupportedCommands): New, split out of constructor. 55 (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Split setup logic out into 56 updateSupportedCommands. Support MRMediaRemoteCommandSeekToPlaybackPosition. Don't assert when 57 receiving an unsupported command, it happens. Return error when a command isn't supported or 58 fails. 59 60 * testing/Internals.cpp: 61 (WebCore::Internals::postRemoteControlCommand): Add command argument parameter. Support 62 seektoplaybackposition. 63 * testing/Internals.h: 64 * testing/Internals.idl: 65 1 66 2016-08-01 Babak Shafiei <bshafiei@apple.com> 2 67 -
branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h
r201013 r204068 315 315 void suspendPlayback() override; 316 316 bool canReceiveRemoteControlCommands() const override { return false; } 317 void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override { } 317 void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) override { } 318 bool supportsSeeking() const override { return false; } 318 319 bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override { return false; } 319 320 -
branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp
r203969 r204068 6839 6839 } 6840 6840 6841 void HTMLMediaElement::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command )6841 void HTMLMediaElement::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument) 6842 6842 { 6843 6843 LOG(Media, "HTMLMediaElement::didReceiveRemoteControlCommand(%p) - %i", this, static_cast<int>(command)); … … 6848 6848 play(); 6849 6849 break; 6850 case PlatformMediaSession::StopCommand: 6850 6851 case PlatformMediaSession::PauseCommand: 6851 6852 pause(); … … 6864 6865 endScanning(); 6865 6866 break; 6867 case PlatformMediaSession::SeekToPlaybackPositionCommand: 6868 ASSERT(argument); 6869 if (argument) 6870 fastSeek(argument->asDouble); 6871 break; 6866 6872 default: 6867 6873 { } // Do nothing 6868 6874 } 6875 } 6876 6877 bool HTMLMediaElement::supportsSeeking() const 6878 { 6879 return !isLiveStream(); 6869 6880 } 6870 6881 -
branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h
r203066 r204068 617 617 618 618 bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&) override; 619 void mediaPlayerHandlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType command) override { didReceiveRemoteControlCommand(command ); }619 void mediaPlayerHandlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType command) override { didReceiveRemoteControlCommand(command, nullptr); } 620 620 String mediaPlayerSourceApplicationIdentifier() const override; 621 621 Vector<String> mediaPlayerPreferredAudioCharacteristics() const override; … … 758 758 double mediaSessionCurrentTime() const override { return currentTime(); } 759 759 bool canReceiveRemoteControlCommands() const override { return true; } 760 void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override; 760 void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) override; 761 bool supportsSeeking() const override; 761 762 bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override; 762 763 bool shouldOverrideBackgroundLoadingRestriction() const override; -
branches/safari-602-branch/Source/WebCore/platform/RemoteCommandListener.h
r185006 r204068 35 35 public: 36 36 virtual ~RemoteCommandListenerClient() { } 37 virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) = 0; 37 virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) = 0; 38 virtual bool supportsSeeking() const = 0; 38 39 }; 39 40 … … 44 45 virtual ~RemoteCommandListener() { } 45 46 47 virtual void updateSupportedCommands() { } 48 49 RemoteCommandListenerClient& client() const { return m_client; } 50 46 51 protected: 47 52 RemoteCommandListenerClient& m_client; -
branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp
r203560 r204068 243 243 } 244 244 245 void PlatformMediaSession::didReceiveRemoteControlCommand(RemoteControlCommandType command) 246 { 247 m_client.didReceiveRemoteControlCommand(command); 245 void PlatformMediaSession::didReceiveRemoteControlCommand(RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument) 246 { 247 m_client.didReceiveRemoteControlCommand(command, argument); 248 } 249 250 bool PlatformMediaSession::supportsSeeking() const 251 { 252 return m_client.supportsSeeking(); 248 253 } 249 254 -
branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h
r202425 r204068 115 115 #endif 116 116 117 typedef union { 118 double asDouble; 119 } RemoteCommandArgument; 120 117 121 enum RemoteControlCommandType { 118 122 NoCommand, … … 125 129 BeginSeekingForwardCommand, 126 130 EndSeekingForwardCommand, 131 SeekToPlaybackPositionCommand, 127 132 }; 128 133 bool canReceiveRemoteControlCommands() const; 129 void didReceiveRemoteControlCommand(RemoteControlCommandType); 134 void didReceiveRemoteControlCommand(RemoteControlCommandType, const RemoteCommandArgument* argument = nullptr); 135 bool supportsSeeking() const; 130 136 131 137 enum DisplayType { … … 203 209 204 210 virtual bool canReceiveRemoteControlCommands() const = 0; 205 virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) = 0; 211 virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) = 0; 212 virtual bool supportsSeeking() const = 0; 206 213 207 214 virtual void setShouldBufferData(bool) { } -
branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
r202642 r204068 267 267 m_sessions.remove(index); 268 268 m_sessions.insert(0, &session); 269 if (m_remoteCommandListener) 270 m_remoteCommandListener->updateSupportedCommands(); 269 271 270 272 LOG(Media, "PlatformMediaSessionManager::setCurrentSession - session moved from index %zu to 0", index); 271 273 } 272 274 273 PlatformMediaSession* PlatformMediaSessionManager::currentSession() 275 PlatformMediaSession* PlatformMediaSessionManager::currentSession() const 274 276 { 275 277 if (!m_sessions.size()) … … 345 347 #endif 346 348 347 void PlatformMediaSessionManager::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command )349 void PlatformMediaSessionManager::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument) 348 350 { 349 351 PlatformMediaSession* activeSession = currentSession(); 350 352 if (!activeSession || !activeSession->canReceiveRemoteControlCommands()) 351 353 return; 352 activeSession->didReceiveRemoteControlCommand(command); 354 activeSession->didReceiveRemoteControlCommand(command, argument); 355 } 356 357 bool PlatformMediaSessionManager::supportsSeeking() const 358 { 359 PlatformMediaSession* activeSession = currentSession(); 360 if (!activeSession) 361 return false; 362 return activeSession->supportsSeeking(); 353 363 } 354 364 -
branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h
r202425 r204068 91 91 92 92 void setCurrentSession(PlatformMediaSession&); 93 PlatformMediaSession* currentSession() ;93 PlatformMediaSession* currentSession() const; 94 94 95 95 PlatformMediaSession* currentSessionMatching(std::function<bool(const PlatformMediaSession&)>); … … 113 113 114 114 // RemoteCommandListenerClient 115 WEBCORE_EXPORT void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override; 115 WEBCORE_EXPORT void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType, const PlatformMediaSession::RemoteCommandArgument*) override; 116 WEBCORE_EXPORT bool supportsSeeking() const override; 116 117 117 118 // AudioHardwareListenerClient -
branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h
r166101 r204068 47 47 protected: 48 48 WeakPtr<RemoteCommandListenerIOS> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); } 49 49 void updateSupportedCommands() override; 50 50 51 WeakPtrFactory<RemoteCommandListenerIOS> m_weakPtrFactory; 51 52 RetainPtr<id> m_playTarget; … … 54 55 RetainPtr<id> m_seekForwardTarget; 55 56 RetainPtr<id> m_seekBackwardTarget; 57 RetainPtr<id> m_seekToTimeTarget; 56 58 }; 57 59 -
branches/safari-602-branch/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm
r185006 r204068 37 37 SOFT_LINK_CLASS(MediaPlayer, MPRemoteCommandCenter) 38 38 SOFT_LINK_CLASS(MediaPlayer, MPSeekCommandEvent) 39 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90100 40 SOFT_LINK_CLASS(MediaPlayer, MPChangePlaybackPositionCommandEvent) 41 #endif 39 42 40 43 namespace WebCore { … … 56 59 if (!weakThis) 57 60 return; 58 weakThis->m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PauseCommand );61 weakThis->m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PauseCommand, nullptr); 59 62 }); 60 63 … … 66 69 if (!weakThis) 67 70 return; 68 weakThis->m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PlayCommand );71 weakThis->m_client.didReceiveRemoteControlCommand(PlatformMediaSession::PlayCommand, nullptr); 69 72 }); 70 73 … … 76 79 if (!weakThis) 77 80 return; 78 weakThis->m_client.didReceiveRemoteControlCommand(PlatformMediaSession::TogglePlayPauseCommand );81 weakThis->m_client.didReceiveRemoteControlCommand(PlatformMediaSession::TogglePlayPauseCommand, nullptr); 79 82 }); 80 83 … … 91 94 if (!weakThis) 92 95 return; 93 weakThis->m_client.didReceiveRemoteControlCommand(command );96 weakThis->m_client.didReceiveRemoteControlCommand(command, nullptr); 94 97 }); 95 98 … … 106 109 if (!weakThis) 107 110 return; 108 weakThis->m_client.didReceiveRemoteControlCommand(command );111 weakThis->m_client.didReceiveRemoteControlCommand(command, nullptr); 109 112 }); 110 113 111 114 return MPRemoteCommandHandlerStatusSuccess; 112 115 }]; 116 117 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90100 118 m_seekToTimeTarget = [[center changePlaybackPositionCommand] addTargetWithHandler:^(MPRemoteCommandEvent *event) { 119 ASSERT([event isKindOfClass:getMPChangePlaybackPositionCommandEventClass()]); 120 121 if (!client.supportsSeeking()) 122 return MPRemoteCommandHandlerStatusCommandFailed; 123 124 MPChangePlaybackPositionCommandEvent* seekEvent = static_cast<MPChangePlaybackPositionCommandEvent *>(event); 125 PlatformMediaSession::RemoteCommandArgument argument { [seekEvent positionTime] }; 126 127 callOnMainThread([weakThis, argument] { 128 if (!weakThis) 129 return; 130 weakThis->m_client.didReceiveRemoteControlCommand(PlatformMediaSession::TogglePlayPauseCommand, &argument); 131 }); 132 133 return MPRemoteCommandHandlerStatusSuccess; 134 }]; 135 #endif 113 136 } 114 137 … … 121 144 [[center seekForwardCommand] removeTarget:m_seekForwardTarget.get()]; 122 145 [[center seekBackwardCommand] removeTarget:m_seekBackwardTarget.get()]; 146 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90100 147 [[center changePlaybackPositionCommand] removeTarget:m_seekToTimeTarget.get()]; 148 #endif 149 } 150 151 void RemoteCommandListenerIOS::updateSupportedCommands() 152 { 153 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90100 154 [[[getMPRemoteCommandCenterClass() sharedCommandCenter] changePlaybackPositionCommand] setEnabled:!!client().supportsSeeking()]; 155 #endif 123 156 } 124 157 -
branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp
r202642 r204068 47 47 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoElapsedTime, CFStringRef); 48 48 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoPlaybackRate, CFStringRef); 49 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteOptionPlaybackPosition, CFStringRef); 49 50 50 51 #endif // USE(MEDIAREMOTE) -
branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h
r202642 r204068 62 62 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoPlaybackRate, CFStringRef); 63 63 #define kMRMediaRemoteNowPlayingInfoPlaybackRate get_MediaRemote_kMRMediaRemoteNowPlayingInfoPlaybackRate() 64 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteOptionPlaybackPosition, CFStringRef); 65 #define kMRMediaRemoteOptionPlaybackPosition get_MediaRemote_kMRMediaRemoteOptionPlaybackPosition() 64 66 65 67 #endif // USE(MEDIAREMOTE) -
branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.h
r202642 r204068 43 43 WeakPtr<RemoteCommandListenerMac> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); } 44 44 45 void updateSupportedCommands() override; 46 45 47 WeakPtrFactory<RemoteCommandListenerMac> m_weakPtrFactory { this }; 46 48 void* m_commandHandler { nullptr }; -
branches/safari-602-branch/Source/WebCore/platform/mac/RemoteCommandListenerMac.mm
r202642 r204068 41 41 } 42 42 43 RemoteCommandListenerMac::RemoteCommandListenerMac(RemoteCommandListenerClient& client) 44 : RemoteCommandListener(client) 43 void RemoteCommandListenerMac::updateSupportedCommands() 45 44 { 46 45 #if USE(MEDIAREMOTE) … … 67 66 } 68 67 68 auto seekCommandInfo = adoptCF(MRMediaRemoteCommandInfoCreate(kCFAllocatorDefault)); 69 MRMediaRemoteCommandInfoSetCommand(seekCommandInfo.get(), MRMediaRemoteCommandSeekToPlaybackPosition); 70 MRMediaRemoteCommandInfoSetEnabled(seekCommandInfo.get(), client().supportsSeeking()); 71 CFArrayAppendValue(commandInfoArray.get(), seekCommandInfo.get()); 72 69 73 MRMediaRemoteSetSupportedCommands(commandInfoArray.get(), MRMediaRemoteGetLocalOrigin(), nullptr, nullptr); 74 #endif // USE(MEDIAREMOTE) 75 } 76 77 RemoteCommandListenerMac::RemoteCommandListenerMac(RemoteCommandListenerClient& client) 78 : RemoteCommandListener(client) 79 { 80 #if USE(MEDIAREMOTE) 81 if (!isMediaRemoteFrameworkAvailable()) 82 return; 83 84 updateSupportedCommands(); 70 85 71 86 auto weakThis = createWeakPtr(); 72 87 m_commandHandler = MRMediaRemoteAddAsyncCommandHandlerBlock(^(MRMediaRemoteCommand command, CFDictionaryRef options, void(^completion)(CFArrayRef)) { 73 UNUSED_PARAM(options); 88 89 LOG(Media, "RemoteCommandListenerMac::RemoteCommandListenerMac - received command %u", command); 74 90 75 91 PlatformMediaSession::RemoteControlCommandType platformCommand { PlatformMediaSession::NoCommand }; 92 PlatformMediaSession::RemoteCommandArgument argument { 0 }; 93 MRMediaRemoteCommandHandlerStatus status = MRMediaRemoteCommandHandlerStatusSuccess; 76 94 77 95 switch (command) { … … 81 99 case MRMediaRemoteCommandPause: 82 100 platformCommand = PlatformMediaSession::PauseCommand; 101 break; 102 case MRMediaRemoteCommandStop: 103 platformCommand = PlatformMediaSession::StopCommand; 83 104 break; 84 105 case MRMediaRemoteCommandTogglePlayPause: … … 97 118 platformCommand = PlatformMediaSession::EndSeekingBackwardCommand; 98 119 break; 120 case MRMediaRemoteCommandSeekToPlaybackPosition: { 121 if (!client.supportsSeeking()) { 122 status = MRMediaRemoteCommandHandlerStatusCommandFailed; 123 break; 124 } 125 126 CFNumberRef positionRef = static_cast<CFNumberRef>(CFDictionaryGetValue(options, kMRMediaRemoteOptionPlaybackPosition)); 127 if (!positionRef) { 128 status = MRMediaRemoteCommandHandlerStatusCommandFailed; 129 break; 130 } 131 132 CFNumberGetValue(positionRef, kCFNumberDoubleType, &argument.asDouble); 133 platformCommand = PlatformMediaSession::SeekToPlaybackPositionCommand; 134 break; 135 } 99 136 default: 100 ASSERT_NOT_REACHED(); 137 LOG(Media, "RemoteCommandListenerMac::RemoteCommandListenerMac - command %u not supported!", command); 138 status = MRMediaRemoteCommandHandlerStatusCommandFailed; 139 return; 101 140 }; 102 141 103 142 if (!weakThis) 104 143 return; 105 weakThis->m_client.didReceiveRemoteControlCommand(platformCommand );106 completion(static_cast<CFArrayRef>(@[@ 0]));144 weakThis->m_client.didReceiveRemoteControlCommand(platformCommand, &argument); 145 completion(static_cast<CFArrayRef>(@[@(status)])); 107 146 }); 108 147 #endif // USE(MEDIAREMOTE) -
branches/safari-602-branch/Source/WebCore/testing/Internals.cpp
r203560 r204068 2862 2862 } 2863 2863 2864 void Internals::postRemoteControlCommand(const String& commandString, ExceptionCode& ec)2864 void Internals::postRemoteControlCommand(const String& commandString, float argument, ExceptionCode& ec) 2865 2865 { 2866 2866 PlatformMediaSession::RemoteControlCommandType command; 2867 2867 PlatformMediaSession::RemoteCommandArgument parameter { argument }; 2868 2868 2869 if (equalLettersIgnoringASCIICase(commandString, "play")) 2869 2870 command = PlatformMediaSession::PlayCommand; … … 2882 2883 else if (equalLettersIgnoringASCIICase(commandString, "endseekingforward")) 2883 2884 command = PlatformMediaSession::EndSeekingForwardCommand; 2885 else if (equalLettersIgnoringASCIICase(commandString, "seektoplaybackposition")) 2886 command = PlatformMediaSession::SeekToPlaybackPositionCommand; 2884 2887 else { 2885 2888 ec = INVALID_ACCESS_ERR; … … 2887 2890 } 2888 2891 2889 PlatformMediaSessionManager::sharedManager().didReceiveRemoteControlCommand(command );2892 PlatformMediaSessionManager::sharedManager().didReceiveRemoteControlCommand(command, ¶meter); 2890 2893 } 2891 2894 -
branches/safari-602-branch/Source/WebCore/testing/Internals.h
r203075 r204068 408 408 void setMediaSessionRestrictions(const String& mediaType, const String& restrictions, ExceptionCode&); 409 409 void setMediaElementRestrictions(HTMLMediaElement&, const String& restrictions); 410 void postRemoteControlCommand(const String&, ExceptionCode&);410 void postRemoteControlCommand(const String&, float argument, ExceptionCode&); 411 411 bool elementIsBlockingDisplaySleep(HTMLMediaElement&) const; 412 412 #endif -
branches/safari-602-branch/Source/WebCore/testing/Internals.idl
r203075 r204068 403 403 [Conditional=VIDEO] void setMediaElementRestrictions(HTMLMediaElement element, DOMString restrictions); 404 404 [Conditional=WEB_AUDIO] void setAudioContextRestrictions(AudioContext context, DOMString restrictions); 405 [Conditional=VIDEO, RaisesException] void postRemoteControlCommand(DOMString command );405 [Conditional=VIDEO, RaisesException] void postRemoteControlCommand(DOMString command, optional unrestricted float argument = 0); 406 406 [Conditional=WIRELESS_PLAYBACK_TARGET] void setMockMediaPlaybackTargetPickerEnabled(boolean enabled); 407 407 [Conditional=WIRELESS_PLAYBACK_TARGET, RaisesException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState);
Note:
See TracChangeset
for help on using the changeset viewer.