Changeset 231866 in webkit
- Timestamp:
- May 16, 2018 1:36:26 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r231865 r231866 1 2018-05-16 Eric Carlson <eric.carlson@apple.com> 2 3 Improve NowPlaying "title" 4 https://bugs.webkit.org/show_bug.cgi?id=185680 5 <rdar://problem/40296700> 6 7 Reviewed by Jer Noble. 8 9 * http/tests/media/now-playing-info-expected.txt: Added. 10 * http/tests/media/now-playing-info-private-browsing-expected.txt: Added. 11 * http/tests/media/now-playing-info-private-browsing.html: Added. 12 * http/tests/media/now-playing-info.html: Added. 13 * platform/gtk/TestExpectations: 14 1 15 2018-05-16 Youenn Fablet <youenn@apple.com> 2 16 -
trunk/LayoutTests/media/video-test.js
r231817 r231866 187 187 } 188 188 189 function waitFor(element, event) {189 function waitFor(element, type) { 190 190 return new Promise(resolve => { 191 element.addEventListener( event, event => {191 element.addEventListener(type, event => { 192 192 consoleWrite(`EVENT(${event.type})`); 193 193 resolve(event); -
trunk/LayoutTests/platform/gtk/TestExpectations
r231701 r231866 1188 1188 webkit.org/b/184295 http/wpt/loading/redirect-headers.html [ Skip ] 1189 1189 1190 # NowPlaying is macOS and iOS only. 1191 http/tests/media/now-playing-info-private-browsing.html [ Skip ] 1192 http/tests/media/now-playing-info.html [ Skip ] 1193 1190 1194 #//////////////////////////////////////////////////////////////////////////////////////// 1191 1195 # End of Expected failures. -
trunk/Source/WebCore/ChangeLog
r231862 r231866 1 2018-05-16 Eric Carlson <eric.carlson@apple.com> 2 3 Improve NowPlaying "title" 4 https://bugs.webkit.org/show_bug.cgi?id=185680 5 <rdar://problem/40296700> 6 7 Reviewed by Jer Noble. 8 9 We send NowPlaying the element's title attribute if not empty, else the element's current url. 10 Title should be preferred because it is the most specific, but we should use the document 11 title if non-empty next, and if falling back to the element's url use just the domain instead 12 of the full url because it isn't likely to be useful to the user given the small amount of 13 space control center uses to display the title. Further, don't use any title at all when 14 in private browsing mode. 15 16 Tests: http/tests/media/now-playing-info-private-browsing.html 17 http/tests/media/now-playing-info.html 18 19 * html/HTMLMediaElement.cpp: 20 (WebCore::HTMLMediaElement::parseAttribute): Update NowPlaying when the title attribute changes. 21 (WebCore::HTMLMediaElement::finishSeek): Update NowPlaying when a seek completes. 22 (WebCore::HTMLMediaElement::mediaSessionTitle const): Update logic. 23 (WebCore::HTMLMediaElement::mediaSessionUniqueIdentifier const): Use the hash of the current 24 url as the unique identifier. 25 * html/HTMLMediaElement.h: 26 27 * platform/audio/PlatformMediaSession.cpp: 28 (WebCore::PlatformMediaSession::uniqueIdentifier const): New. 29 (WebCore::PlatformMediaSessionClient::mediaSessionUniqueIdentifier const): Ditto. 30 * platform/audio/PlatformMediaSession.h: 31 32 * platform/audio/ios/MediaSessionManagerIOS.mm: 33 (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Update m_lastUpdatedNowPlayingInfoUniqueIdentifier. 34 35 * platform/audio/mac/MediaSessionManagerMac.mm: 36 (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Update. 37 38 * testing/Internals.cpp: 39 (WebCore::Internals::nowPlayingState const): Expose NowPlaying state. 40 * testing/Internals.h: 41 * testing/Internals.idl: 42 1 43 2018-05-16 Daniel Bates <dabates@apple.com> 2 44 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r231839 r231866 879 879 if (processingUserGestureForMedia()) 880 880 removeBehaviorsRestrictionsAfterFirstUserGesture(); 881 } else if (name == titleAttr) { 882 if (m_mediaSession) 883 m_mediaSession->clientCharacteristicsChanged(); 881 884 } 882 885 else … … 3081 3084 // 17 - Queue a task to fire a simple event named seeked at the element. 3082 3085 scheduleEvent(eventNames().seekedEvent); 3086 3087 if (m_mediaSession) 3088 m_mediaSession->clientCharacteristicsChanged(); 3083 3089 3084 3090 #if ENABLE(MEDIA_SOURCE) … … 7444 7450 String HTMLMediaElement::mediaSessionTitle() const 7445 7451 { 7446 if (hasAttributeWithoutSynchronization(titleAttr)) 7447 return attributeWithoutSynchronization(titleAttr); 7448 7449 return m_currentSrc; 7452 if (!document().page() || document().page()->usesEphemeralSession()) 7453 return emptyString(); 7454 7455 if (hasAttributeWithoutSynchronization(titleAttr)) { 7456 auto title = attributeWithoutSynchronization(titleAttr); 7457 if (!title.isEmpty()) 7458 return title; 7459 } 7460 7461 auto title = document().title(); 7462 if (!title.isEmpty()) 7463 return title; 7464 7465 return m_currentSrc.host(); 7466 } 7467 7468 uint64_t HTMLMediaElement::mediaSessionUniqueIdentifier() const 7469 { 7470 auto& url = m_currentSrc.string(); 7471 return url.impl() ? url.impl()->hash() : 0; 7450 7472 } 7451 7473 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r231817 r231866 861 861 void resumeAutoplaying() override; 862 862 void mayResumePlayback(bool shouldResume) override; 863 uint64_t mediaSessionUniqueIdentifier() const final; 863 864 String mediaSessionTitle() const override; 864 865 double mediaSessionDuration() const override { return duration(); } -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp
r231817 r231866 239 239 240 240 #if ENABLE(VIDEO) 241 uint64_t PlatformMediaSession::uniqueIdentifier() const 242 { 243 return m_client.mediaSessionUniqueIdentifier(); 244 } 245 241 246 String PlatformMediaSession::title() const 242 247 { … … 324 329 325 330 #if ENABLE(VIDEO) 331 uint64_t PlatformMediaSessionClient::mediaSessionUniqueIdentifier() const 332 { 333 return 0; 334 } 335 326 336 String PlatformMediaSessionClient::mediaSessionTitle() const 327 337 { -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.h
r231817 r231866 114 114 115 115 #if ENABLE(VIDEO) 116 uint64_t uniqueIdentifier() const; 116 117 String title() const; 117 118 double duration() const; … … 217 218 218 219 #if ENABLE(VIDEO) 220 virtual uint64_t mediaSessionUniqueIdentifier() const; 219 221 virtual String mediaSessionTitle() const; 220 222 virtual double mediaSessionDuration() const; -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r231817 r231866 281 281 m_reportedTitle = title; 282 282 m_reportedCurrentTime = currentTime; 283 m_lastUpdatedNowPlayingInfoUniqueIdentifier = currentSession->uniqueIdentifier(); 283 284 284 285 auto info = adoptNS([[NSMutableDictionary alloc] init]); -
trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm
r227529 r231866 177 177 CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoPlaybackRate, cfRate.get()); 178 178 179 m_lastUpdatedNowPlayingInfoUniqueIdentifier = title.impl() ? title.impl()->hash() : 0;179 m_lastUpdatedNowPlayingInfoUniqueIdentifier = currentSession->uniqueIdentifier(); 180 180 auto cfIdentifier = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberLongLongType, &m_lastUpdatedNowPlayingInfoUniqueIdentifier)); 181 181 CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoUniqueIdentifier, cfIdentifier.get()); -
trunk/Source/WebCore/testing/Internals.cpp
r231839 r231866 3693 3693 } 3694 3694 3695 ExceptionOr<Internals::NowPlayingState> Internals::nowPlayingState() const 3696 { 3697 #if ENABLE(VIDEO) 3698 return { { PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingTitle(), 3699 PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingDuration(), 3700 PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingElapsedTime(), 3701 PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingInfoUniqueIdentifier(), 3702 PlatformMediaSessionManager::sharedManager().hasActiveNowPlayingSession(), 3703 PlatformMediaSessionManager::sharedManager().registeredAsNowPlayingApplication() 3704 } }; 3705 #else 3706 return Exception { InvalidAccessError }; 3707 #endif 3708 } 3709 3695 3710 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 3696 3711 -
trunk/Source/WebCore/testing/Internals.h
r231817 r231866 671 671 bool usingAppleInternalSDK() const; 672 672 673 struct NowPlayingState { 674 String title; 675 double duration; 676 double elapsedTime; 677 uint64_t uniqueIdentifier; 678 bool hasActiveSession; 679 bool registeredAsNowPlayingApplication; 680 }; 681 ExceptionOr<NowPlayingState> nowPlayingState() const; 682 673 683 private: 674 684 explicit Internals(Document&); -
trunk/Source/WebCore/testing/Internals.idl
r231817 r231866 85 85 [ 86 86 ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, 87 Conditional=VIDEO, 88 JSGenerateToJSObject, 89 ] dictionary NowPlayingState { 90 boolean hasActiveSession; 91 boolean registeredAsNowPlayingApplication; 92 DOMString title; 93 unrestricted double duration; 94 unrestricted double elapsedTime; 95 unsigned long long uniqueIdentifier; 96 }; 97 98 [ 99 ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, 87 100 NoInterfaceObject, 88 101 ] interface Internals { … … 602 615 603 616 boolean usingAppleInternalSDK(); 604 }; 617 618 [Conditional=VIDEO, MayThrowException] readonly attribute NowPlayingState nowPlayingState; 619 };
Note: See TracChangeset
for help on using the changeset viewer.