Set MediaRemote playback state based on MediaSession playback state.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jul 2016 02:18:30 +0000 (02:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jul 2016 02:18:30 +0000 (02:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160177

Patch by Jeremy Jones <jeremyj@apple.com> on 2016-07-25
Reviewed by Eric Carlson.

Use playback session state to update media remote playback state instead of
unconditionally setting it to playing.

* platform/audio/mac/MediaSessionManagerMac.mm:
(WebCore::MediaSessionManagerMac::updateNowPlayingInfo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203706 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm

index a9fa384..b70b552 100644 (file)
@@ -1,3 +1,16 @@
+2016-07-25  Jeremy Jones  <jeremyj@apple.com>
+
+        Set MediaRemote playback state based on MediaSession playback state.
+        https://bugs.webkit.org/show_bug.cgi?id=160177
+
+        Reviewed by Eric Carlson.
+
+        Use playback session state to update media remote playback state instead of 
+        unconditionally setting it to playing.
+
+        * platform/audio/mac/MediaSessionManagerMac.mm:
+        (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
+
 2016-07-25  Zalan Bujtas  <zalan@apple.com>
 
         RenderBox::haveSameDirection is used only by table items.
index 9e20134..b4ea045 100644 (file)
@@ -173,7 +173,8 @@ void MediaSessionManagerMac::updateNowPlayingInfo()
         title.utf8().data(), rate, duration, currentTime);
 
     m_nowPlayingActive = true;
-    MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), kMRPlaybackStatePlaying, dispatch_get_main_queue(), ^(MRMediaRemoteError error) {
+    MRPlaybackState playbackState = (currentSession->state() == PlatformMediaSession::Playing) ? kMRPlaybackStatePlaying : kMRPlaybackStatePaused;
+    MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), playbackState, dispatch_get_main_queue(), ^(MRMediaRemoteError error) {
 #if LOG_DISABLED
         UNUSED_PARAM(error);
 #else