Changeset 162360 in webkit
- Timestamp:
- Jan 20, 2014, 11:23:40 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r162359 r162360 1 2014-01-20 Eric Carlson <eric.carlson@apple.com> 2 3 Allow MediaSessionManager to restrict 'preload' behavior 4 https://bugs.webkit.org/show_bug.cgi?id=127297 5 6 Reviewed by Jer Noble. 7 8 * media/video-restricted-no-preload-auto-expected.txt: Added. 9 * media/video-restricted-no-preload-auto.html: Added. 10 * media/video-restricted-no-preload-metadata-expected.txt: Added. 11 * media/video-restricted-no-preload-metadata.html: Added. 12 1 13 2014-01-20 Mihai Tica <mitica@adobe.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r162356 r162360 1 2014-01-20 Eric Carlson <eric.carlson@apple.com> 2 3 Allow MediaSessionManager to restrict 'preload' behavior 4 https://bugs.webkit.org/show_bug.cgi?id=127297 5 6 Reviewed by Jer Noble. 7 8 Tests: media/video-restricted-no-preload-auto.html 9 media/video-restricted-no-preload-metadata.html 10 11 * html/HTMLMediaElement.cpp: 12 (WebCore::HTMLMediaElement::parseAttribute): Apply restrictions to preload attribute before 13 passing to media engine. 14 (WebCore::HTMLMediaElement::loadResource): Ditto. 15 16 * html/HTMLMediaSession.cpp: 17 (WebCore::HTMLMediaSession::effectivePreloadForElement): New, limit preload according to restrictions. 18 * html/HTMLMediaSession.h: 19 20 * platform/audio/MediaSessionManager.h: 21 * platform/audio/ios/MediaSessionManagerIOS.mm: 22 (WebCore::MediaSessionManageriOS::resetRestrictions): Limit preload to metadata only. Drive-by 23 static deviceClass initialization cleanup. 24 25 * testing/Internals.cpp: 26 (WebCore::Internals::setMediaSessionRestrictions): Support MetadataPreloadingNotPermitted and 27 AutoPreloadingNotPermitted. 28 1 29 2014-01-20 Andreas Kling <akling@apple.com> 2 30 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r162145 r162360 547 547 // The attribute must be ignored if the autoplay attribute is present 548 548 if (!autoplay() && m_player) 549 m_player->setPreload(m_ preload);549 m_player->setPreload(m_mediaSession->effectivePreloadForElement(*this)); 550 550 551 551 } else if (name == mediagroupAttr) … … 988 988 // algorithm, but do it now because we won't start that until after the timer fires and the 989 989 // event may have already fired by then. 990 if (m_preload != MediaPlayer::None) 990 MediaPlayer::Preload effectivePreload = m_mediaSession->effectivePreloadForElement(*this); 991 if (effectivePreload != MediaPlayer::None) 991 992 setShouldDelayLoadEvent(true); 992 993 993 994 #if PLATFORM(IOS) 994 995 Settings* settings = document().settings(); 995 if ( m_preload != MediaPlayer::None && settings && settings->mediaDataLoadsAutomatically())996 if (effectivePreload != MediaPlayer::None && settings && settings->mediaDataLoadsAutomatically()) 996 997 prepareToPlay(); 997 998 #endif … … 1212 1213 1213 1214 if (!autoplay()) 1214 m_player->setPreload(m_ preload);1215 m_player->setPreload(m_mediaSession->effectivePreloadForElement(*this)); 1215 1216 m_player->setPreservesPitch(m_webkitPreservesPitch); 1216 1217 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r162139 r162360 425 425 #endif 426 426 427 MediaPlayer::Preload preloadValue() const { return m_preload; } 428 427 429 protected: 428 430 HTMLMediaElement(const QualifiedName&, Document&, bool); -
trunk/Source/WebCore/html/HTMLMediaSession.cpp
r162221 r162360 144 144 #endif 145 145 146 MediaPlayer::Preload HTMLMediaSession::effectivePreloadForElement(const HTMLMediaElement& element) const 147 { 148 MediaSessionManager::SessionRestrictions restrictions = MediaSessionManager::sharedManager().restrictions(mediaType()); 149 MediaPlayer::Preload preload = element.preloadValue(); 150 151 if ((restrictions & MediaSessionManager::MetadataPreloadingNotPermitted) == MediaSessionManager::MetadataPreloadingNotPermitted) 152 return MediaPlayer::None; 153 154 if ((restrictions & MediaSessionManager::AutoPreloadingNotPermitted) == MediaSessionManager::AutoPreloadingNotPermitted) { 155 if (preload > MediaPlayer::MetaData) 156 return MediaPlayer::MetaData; 157 } 158 159 return preload; 160 } 161 146 162 void HTMLMediaSession::clientWillBeginPlayback() const 147 163 { -
trunk/Source/WebCore/html/HTMLMediaSession.h
r162145 r162360 29 29 #if ENABLE(VIDEO) 30 30 31 #include "MediaPlayer.h" 31 32 #include "MediaSession.h" 32 33 … … 53 54 #endif 54 55 bool requiresFullscreenForVideoPlayback(const HTMLMediaElement&) const; 56 MediaPlayer::Preload effectivePreloadForElement(const HTMLMediaElement&) const; 55 57 56 58 // Restrictions to modify default behaviors. -
trunk/Source/WebCore/platform/audio/MediaSessionManager.h
r162178 r162360 51 51 NoRestrictions = 0, 52 52 ConcurrentPlaybackNotPermitted = 1 << 0, 53 InlineVideoPlaybackRestricted = 1 << 0, 53 InlineVideoPlaybackRestricted = 1 << 1, 54 MetadataPreloadingNotPermitted = 1 << 2, 55 AutoPreloadingNotPermitted = 1 << 3, 54 56 }; 55 57 typedef unsigned SessionRestrictions; -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r162218 r162360 80 80 MediaSessionManager::resetRestrictions(); 81 81 82 DEFINE_STATIC_LOCAL(wkDeviceClass, deviceClass, (iosDeviceClass())); 83 82 static wkDeviceClass deviceClass = iosDeviceClass(); 84 83 if (deviceClass == wkDeviceClassiPhone || deviceClass == wkDeviceClassiPod) 85 84 addRestriction(MediaSession::Video, InlineVideoPlaybackRestricted); 86 85 87 86 addRestriction(MediaSession::Video, ConcurrentPlaybackNotPermitted); 87 removeRestriction(MediaSession::Audio, MetadataPreloadingNotPermitted); 88 removeRestriction(MediaSession::Video, MetadataPreloadingNotPermitted); 89 addRestriction(MediaSession::Audio, AutoPreloadingNotPermitted); 90 addRestriction(MediaSession::Video, AutoPreloadingNotPermitted); 88 91 } 89 92 -
trunk/Source/WebCore/testing/Internals.cpp
r162264 r162360 2212 2212 if (equalIgnoringCase(restrictionsString, "InlineVideoPlaybackRestricted")) 2213 2213 restrictions += MediaSessionManager::InlineVideoPlaybackRestricted; 2214 2214 if (equalIgnoringCase(restrictionsString, "MetadataPreloadingNotPermitted")) 2215 restrictions += MediaSessionManager::MetadataPreloadingNotPermitted; 2216 if (equalIgnoringCase(restrictionsString, "AutoPreloadingNotPermitted")) 2217 restrictions += MediaSessionManager::AutoPreloadingNotPermitted; 2218 2215 2219 MediaSessionManager::sharedManager().addRestriction(mediaType, restrictions); 2216 2220 }
Note:
See TracChangeset
for help on using the changeset viewer.