Changeset 221016 in webkit
- Timestamp:
- Aug 22, 2017, 9:13:22 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/media/video-restricted-invisible-autoplay-not-allowed-source-expected.txt (added)
-
LayoutTests/media/video-restricted-invisible-autoplay-not-allowed-source.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (4 diffs)
-
Source/WebCore/html/HTMLMediaElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r221014 r221016 1 2017-08-22 Jer Noble <jer.noble@apple.com> 2 3 Autoplay Muted Videos Don't Play When Outside Viewport 4 https://bugs.webkit.org/show_bug.cgi?id=175748 5 <rdar://problem/33974383> 6 7 Reviewed by Eric Carlson. 8 9 * media/video-restricted-invisible-autoplay-not-allowed-source-expected.txt: Added. 10 * media/video-restricted-invisible-autoplay-not-allowed-source.html: Added. 11 1 12 2017-08-21 Matt Rajca <mrajca@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r221014 r221016 1 2017-08-22 Jer Noble <jer.noble@apple.com> 2 3 Autoplay Muted Videos Don't Play When Outside Viewport 4 https://bugs.webkit.org/show_bug.cgi?id=175748 5 <rdar://problem/33974383> 6 7 Reviewed by Eric Carlson. 8 9 Test: media/video-restricted-invisible-autoplay-not-allowed-source.html 10 11 The media session is notified that its client (the media element) will begin autoplaying inside 12 prepareForLoad(), where the m_autoplaying flag is also set. But loading via <source> elements does not go 13 through prepareForLoad(); the HTML standard states that the <source> element loading path does not trigger the 14 "media element load algorithm" which is implemented in prepareForLoad(). Since the m_autoplaying flag is 15 initially set to true, notify the media session that the element will begin autoplaying inside the element's 16 constructor. 17 18 Drive-by fix: Doing the above causes other tests to crash, as purturbing play state during style change can cause 19 re-entrancy in the native controls code, or fail, since we will transition from autoplay -> play even if there's 20 not yet a src or source to the media element. Add a task queue for updating the autoplay state and check the ready 21 state before allowing autoplay to transition to play. 22 23 * html/HTMLMediaElement.cpp: 24 (WebCore::HTMLMediaElement::HTMLMediaElement): 25 (WebCore::HTMLMediaElement::~HTMLMediaElement): 26 (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const): 27 (WebCore::HTMLMediaElement::isVisibleInViewportChanged): 28 1 29 2017-08-21 Matt Rajca <mrajca@apple.com> 2 30 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r220962 r221016 520 520 AudioSession::sharedSession().addMutedStateObserver(this); 521 521 #endif 522 523 mediaSession().clientWillBeginAutoplaying(); 522 524 } 523 525 … … 596 598 m_playbackControlsManagerBehaviorRestrictionsQueue.close(); 597 599 m_resourceSelectionTaskQueue.close(); 600 m_visibilityChangeTaskQueue.close(); 598 601 #if ENABLE(ENCRYPTED_MEDIA) 599 602 m_encryptedMediaQueue.close(); … … 2333 2336 { 2334 2337 if (isAutoplaying() 2335 && mediaSession().autoplayPermitted() 2336 && paused() 2337 && autoplay() 2338 && !pausedForUserInteraction() 2339 && !document().isSandboxed(SandboxAutomaticFeatures)) 2338 && mediaSession().autoplayPermitted() 2339 && paused() 2340 && autoplay() 2341 && !pausedForUserInteraction() 2342 && !document().isSandboxed(SandboxAutomaticFeatures) 2343 && m_readyState == HAVE_ENOUGH_DATA) 2340 2344 return mediaSession().playbackPermitted(*this); 2341 2345 … … 7622 7626 void HTMLMediaElement::isVisibleInViewportChanged() 7623 7627 { 7624 updateShouldAutoplay(); 7625 scheduleUpdatePlaybackControlsManager(); 7628 m_visibilityChangeTaskQueue.enqueueTask([this] { 7629 updateShouldAutoplay(); 7630 scheduleUpdatePlaybackControlsManager(); 7631 }); 7626 7632 } 7627 7633 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r220962 r221016 902 902 GenericTaskQueue<Timer> m_playbackControlsManagerBehaviorRestrictionsQueue; 903 903 GenericTaskQueue<Timer> m_resourceSelectionTaskQueue; 904 GenericTaskQueue<Timer> m_visibilityChangeTaskQueue; 904 905 RefPtr<TimeRanges> m_playedTimeRanges; 905 906 GenericEventQueue m_asyncEventQueue;
Note:
See TracChangeset
for help on using the changeset viewer.