Title: [200771] branches/safari-601.1.46-branch/Source/WebCore
- Revision
- 200771
- Author
- [email protected]
- Date
- 2016-05-12 08:25:58 -0700 (Thu, 12 May 2016)
Log Message
Merged r200466. rdar://problem/26228860
Modified Paths
Diff
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (200770 => 200771)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2016-05-12 14:48:03 UTC (rev 200770)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2016-05-12 15:25:58 UTC (rev 200771)
@@ -1,3 +1,19 @@
+2016-05-12 Babak Shafiei <[email protected]>
+
+ Merge r200466.
+
+ 2016-05-05 Eric Carlson <[email protected]>
+
+ [iOS] Media information is sometimes not shown in Control Center
+ https://bugs.webkit.org/show_bug.cgi?id=157377
+
+ Reviewed by Jer Noble.
+
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Store values passed to MPNowPlayingInfoCenter
+ individually instead of in a dictionary.
+
2016-05-12 Matthew Hanson <[email protected]>
Merge r199351. rdar://problem/26228860
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (200770 => 200771)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2016-05-12 14:48:03 UTC (rev 200770)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h 2016-05-12 15:25:58 UTC (rev 200771)
@@ -73,7 +73,10 @@
PlatformMediaSession* nowPlayingEligibleSession();
RetainPtr<WebMediaSessionHelper> m_objcObserver;
- RetainPtr<NSMutableDictionary> m_nowPlayingInfo;
+ double m_reportedRate { 0 };
+ double m_reportedDuration { 0 };
+ String m_reportedTitle;
+ bool m_nowPlayingActive { false };
bool m_isInBackground { false };
};
Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (200770 => 200771)
--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2016-05-12 14:48:03 UTC (rev 200770)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm 2016-05-12 15:25:58 UTC (rev 200771)
@@ -250,40 +250,42 @@
LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - currentSession = %p", currentSession);
if (!currentSession) {
- if (m_nowPlayingInfo) {
+ if (m_nowPlayingActive) {
LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - clearing now playing info");
[nowPlaying setNowPlayingInfo:nil];
- m_nowPlayingInfo = nil;
+ m_nowPlayingActive = false;
}
return;
}
- RetainPtr<NSMutableDictionary> info = adoptNS([[NSMutableDictionary alloc] init]);
-
String title = currentSession->title();
- if (!title.isEmpty())
- [info setValue:static_cast<NSString *>(title) forKey:MPMediaItemPropertyTitle];
-
double duration = currentSession->duration();
- if (std::isfinite(duration) && duration != MediaPlayer::invalidTime())
- [info setValue:@(duration) forKey:MPMediaItemPropertyPlaybackDuration];
-
- [info setValue:(currentSession->state() == PlatformMediaSession::Playing ? @YES : @NO) forKey:MPNowPlayingInfoPropertyPlaybackRate];
-
- if ([m_nowPlayingInfo.get() isEqualToDictionary:info.get()]) {
+ double rate = currentSession->state() == PlatformMediaSession::Playing ? 1 : 0;
+ if (m_reportedTitle == title && m_reportedRate == rate && m_reportedDuration == duration) {
LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - nothing new to show");
return;
}
- m_nowPlayingInfo = info;
+ m_reportedRate = rate;
+ m_reportedDuration = duration;
+ m_reportedTitle = title;
+ auto info = adoptNS([[NSMutableDictionary alloc] init]);
+ if (!title.isEmpty())
+ info.get()[MPMediaItemPropertyTitle] = static_cast<NSString *>(title);
+ if (std::isfinite(duration) && duration != MediaPlayer::invalidTime())
+ info.get()[MPMediaItemPropertyPlaybackDuration] = @(duration);
+ info.get()[MPNowPlayingInfoPropertyPlaybackRate] = @(rate);
+
double currentTime = currentSession->currentTime();
if (std::isfinite(currentTime) && currentTime != MediaPlayer::invalidTime())
- [info setValue:@(currentTime) forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
+ info.get()[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(currentTime);
- LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - title = \"%s\"", [[info.get() valueForKey:MPMediaItemPropertyTitle] UTF8String]);
+ LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f",
+ title.utf8().data(), rate, duration, currentTime);
+ m_nowPlayingActive = true;
[nowPlaying setNowPlayingInfo:info.get()];
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes