Changeset 198211 in webkit
- Timestamp:
- Mar 15, 2016 8:20:40 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r198203 r198211 1 2016-03-14 Jer Noble <jer.noble@apple.com> 2 3 Video elements with autoplay do not begin playing when scrolling into view if InvisibleAutoplayNotPermitted is set. 4 https://bugs.webkit.org/show_bug.cgi?id=155468 5 6 Reviewed by Eric Carlson. 7 8 * media/video-restricted-invisible-autoplay-allowed-when-visible-expected.txt: Added. 9 * media/video-restricted-invisible-autoplay-allowed-when-visible.html: Added. 10 1 11 2016-03-15 Jiewen Tan <jiewen_tan@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r198210 r198211 1 2016-03-14 Jer Noble <jer.noble@apple.com> 2 3 Video elements with autoplay do not begin playing when scrolling into view if InvisibleAutoplayNotPermitted is set. 4 https://bugs.webkit.org/show_bug.cgi?id=155468 5 6 Reviewed by Eric Carlson. 7 8 Test: media/video-restricted-invisible-autoplay-allowed-when-visible.html 9 10 A few bugs came together to cause this behavior. We were not telling the media session that we were going to begin 11 the autoplaying state, we were not restoring the correct state when the interruption ended, and we were not checking 12 to see if we could actually play correctly when the interruption ended. 13 14 * html/HTMLMediaElement.cpp: 15 (WebCore::HTMLMediaElement::prepareForLoad): 16 (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay): 17 (WebCore::HTMLMediaElement::setReadyState): 18 (WebCore::HTMLMediaElement::resumeAutoplaying): 19 (WebCore::HTMLMediaElement::updateShouldPlay): 20 (WebCore::elementCanTransitionFromAutoplayToPlay): Deleted. 21 * html/HTMLMediaElement.h: 22 * platform/audio/PlatformMediaSession.cpp: 23 (WebCore::PlatformMediaSession::endInterruption): 24 1 25 2016-03-15 Manuel Rego Casasnovas <rego@igalia.com> 2 26 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r198180 r198211 1070 1070 m_error = nullptr; 1071 1071 m_autoplaying = true; 1072 mediaSession().clientWillBeginAutoplaying(); 1072 1073 1073 1074 // 7 - Invoke the media element's resource selection algorithm. … … 2091 2092 } 2092 2093 2093 static bool elementCanTransitionFromAutoplayToPlay(HTMLMediaElement& element) 2094 { 2095 return element.isAutoplaying() 2096 && element.paused() 2097 && element.autoplay() 2098 && !element.document().isSandboxed(SandboxAutomaticFeatures) 2099 && element.mediaSession().playbackPermitted(element); 2094 bool HTMLMediaElement::canTransitionFromAutoplayToPlay() const 2095 { 2096 return isAutoplaying() 2097 && paused() 2098 && autoplay() 2099 && !pausedForUserInteraction() 2100 && !document().isSandboxed(SandboxAutomaticFeatures) 2101 && mediaSession().playbackPermitted(*this); 2100 2102 } 2101 2103 … … 2210 2212 scheduleEvent(eventNames().playingEvent); 2211 2213 2212 if ( elementCanTransitionFromAutoplayToPlay(*this)) {2214 if (canTransitionFromAutoplayToPlay()) { 2213 2215 m_paused = false; 2214 2216 invalidateCachedTime(); … … 6537 6539 m_autoplaying = true; 6538 6540 6539 if ( elementCanTransitionFromAutoplayToPlay(*this))6541 if (canTransitionFromAutoplayToPlay()) 6540 6542 play(); 6541 6543 } … … 6832 6834 if (isPlaying() && !m_mediaSession->playbackPermitted(*this)) 6833 6835 pauseInternal(); 6834 else if ( elementCanTransitionFromAutoplayToPlay(*this))6836 else if (canTransitionFromAutoplayToPlay()) 6835 6837 play(); 6836 6838 } -
trunk/Source/WebCore/html/HTMLMediaElement.h
r198002 r198211 691 691 bool pausedForUserInteraction() const; 692 692 bool couldPlayIfEnoughData() const; 693 bool canTransitionFromAutoplayToPlay() const; 693 694 694 695 MediaTime minTimeSeekable() const; -
trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp
r195154 r198211 130 130 m_stateToRestore = Idle; 131 131 m_interruptionType = NoInterruption; 132 setState( Paused);132 setState(stateToRestore); 133 133 134 134 if (stateToRestore == Autoplaying)
Note: See TracChangeset
for help on using the changeset viewer.