Changeset 245467 in webkit
- Timestamp:
- May 17, 2019 9:39:09 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245466 r245467 1 2019-05-17 Eric Carlson <eric.carlson@apple.com> 2 3 Allow sequential playback of media files when initial playback started with a user gesture 4 https://bugs.webkit.org/show_bug.cgi?id=197959 5 <rdar://problem/50655207> 6 7 Reviewed by Youenn Fablet. 8 9 * media/media-fullscreen.js: Insert a pause between tests to clear the user gesture 10 used in the first test. 11 * media/playlist-inherits-user-gesture-expected.txt: Added. 12 * media/playlist-inherits-user-gesture.html: Added. 13 1 14 2019-05-17 Truitt Savell <tsavell@apple.com> 2 15 -
trunk/LayoutTests/media/media-fullscreen.js
r220974 r245467 15 15 if (movie.type == 'video') 16 16 testDOMException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR"); 17 openNextMovie(); 17 18 // A user gesture will transfer across setTimeout for 1 second, so pause to let that 19 // expire before opening the next movie. 20 setTimeout(openNextMovie, 1010); 18 21 } 19 22 } … … 63 66 64 67 consoleWrite("* event handler NOT triggered by a user gesture"); 65 66 68 if (movie.type == 'video') { 67 69 testExpected("mediaElement.webkitSupportsFullscreen", movie.supportsFS); … … 81 83 82 84 // Click on the button 83 if (window.testRunner) 84 setTimeout(clickEnterFullscreenButton, 10); 85 else 86 openNextMovie(); 85 runWithKeyDown(clickEnterFullscreenButton); 87 86 } 88 87 -
trunk/Source/WebCore/ChangeLog
r245464 r245467 1 2019-05-17 Eric Carlson <eric.carlson@apple.com> 2 3 Allow sequential playback of media files when initial playback started with a user gesture 4 https://bugs.webkit.org/show_bug.cgi?id=197959 5 <rdar://problem/50655207> 6 7 Reviewed by Youenn Fablet. 8 9 Test: media/playlist-inherits-user-gesture.html 10 11 * dom/Document.cpp: 12 (WebCore::Document::processingUserGestureForMedia const): Return true if it is within 13 one second of the last HTMLMediaElement 'ended' event. 14 * dom/Document.h: 15 (WebCore::Document::mediaFinishedPlaying): 16 17 * html/HTMLMediaElement.cpp: 18 (WebCore::HTMLMediaElement::parseAttribute): removeBehaviorsRestrictionsAfterFirstUserGesture -> 19 removeBehaviorRestrictionsAfterFirstUserGesture. 20 (WebCore::HTMLMediaElement::load): Ditto. Don't call removeBehaviorsRestrictionsAfterFirstUserGesture, 21 it will be done in prepareForLoad. 22 (WebCore::HTMLMediaElement::prepareForLoad): removeBehaviorsRestrictionsAfterFirstUserGesture -> 23 removeBehaviorRestrictionsAfterFirstUserGesture. 24 (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Ditto. 25 (WebCore::HTMLMediaElement::play): Ditto. 26 (WebCore::HTMLMediaElement::pause): Ditto. 27 (WebCore::HTMLMediaElement::setVolume): Ditto. 28 (WebCore::HTMLMediaElement::setMuted): Ditto. 29 (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Ditto. 30 (WebCore::HTMLMediaElement::dispatchEvent): Call document().mediaFinishedPlaying() 31 when dispatching the 'ended' event. 32 (WebCore::HTMLMediaElement::removeBehaviorRestrictionsAfterFirstUserGesture): Rename. Set 33 m_removedBehaviorRestrictionsAfterFirstUserGesture. 34 (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Deleted. 35 * html/HTMLMediaElement.h: 36 37 * html/HTMLVideoElement.cpp: 38 (WebCore:HTMLVideoElement::nativeImageForCurrentTime): Convert to runtime logging. 39 (WebCore:HTMLVideoElement::webkitEnterFullscreen): Ditto. 40 (WebCore:HTMLVideoElement::webkitSetPresentationMode): Ditto. 41 (WebCore:HTMLVideoElement::fullscreenModeChanged): Ditto. 42 43 * html/MediaElementSession.cpp: 44 (WebCore::MediaElementSession::removeBehaviorRestriction): Update log message. 45 1 46 2019-05-17 Brent Fulgham <bfulgham@apple.com> 2 47 -
trunk/Source/WebCore/dom/Document.cpp
r245368 r245467 329 329 static const unsigned cMaxWriteRecursionDepth = 21; 330 330 bool Document::hasEverCreatedAnAXObjectCache = false; 331 static const Seconds maxIntervalForUserGestureForwardingAfterMediaFinishesPlaying { 1_s }; 331 332 332 333 // DOM Level 2 says (letters added): … … 6577 6578 return true; 6578 6579 6580 if (m_userActivatedMediaFinishedPlayingTimestamp + maxIntervalForUserGestureForwardingAfterMediaFinishesPlaying >= MonotonicTime::now()) 6581 return true; 6582 6579 6583 if (settings().mediaUserGestureInheritsFromDocument()) 6580 6584 return topDocument().hasHadUserInteraction(); -
trunk/Source/WebCore/dom/Document.h
r245368 r245467 1222 1222 void updateLastHandledUserGestureTimestamp(MonotonicTime); 1223 1223 bool processingUserGestureForMedia() const; 1224 void userActivatedMediaFinishedPlaying() { m_userActivatedMediaFinishedPlayingTimestamp = MonotonicTime::now(); } 1224 1225 1225 1226 void setUserDidInteractWithPage(bool userDidInteractWithPage) { ASSERT(&topDocument() == this); m_userDidInteractWithPage = userDidInteractWithPage; } … … 1836 1837 1837 1838 MonotonicTime m_lastHandledUserGestureTimestamp; 1839 MonotonicTime m_userActivatedMediaFinishedPlayingTimestamp; 1838 1840 1839 1841 void clearScriptedAnimationController(); -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r245039 r245467 840 840 else if (name == autoplayAttr) { 841 841 if (processingUserGestureForMedia()) 842 removeBehavior sRestrictionsAfterFirstUserGesture();842 removeBehaviorRestrictionsAfterFirstUserGesture(); 843 843 } else if (name == titleAttr) { 844 844 if (m_mediaSession) … … 1179 1179 INFO_LOG(LOGIDENTIFIER); 1180 1180 1181 if (processingUserGestureForMedia())1182 removeBehaviorsRestrictionsAfterFirstUserGesture();1183 1184 1181 prepareForLoad(); 1185 1182 m_resourceSelectionTaskQueue.enqueueTask([this] { … … 1194 1191 // 12 February 2017 1195 1192 1196 INFO_LOG(LOGIDENTIFIER); 1193 ALWAYS_LOG(LOGIDENTIFIER, "gesture = ", processingUserGestureForMedia()); 1194 1195 if (processingUserGestureForMedia()) 1196 removeBehaviorRestrictionsAfterFirstUserGesture(); 1197 1197 1198 1198 // 1 - Abort any already-running instance of the resource selection algorithm for this element. … … 1952 1952 m_audioTracks->scheduleChangeEvent(); 1953 1953 if (processingUserGestureForMedia()) 1954 removeBehavior sRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager);1954 removeBehaviorRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager); 1955 1955 } 1956 1956 … … 3516 3516 3517 3517 if (processingUserGestureForMedia()) 3518 removeBehavior sRestrictionsAfterFirstUserGesture();3518 removeBehaviorRestrictionsAfterFirstUserGesture(); 3519 3519 3520 3520 m_pendingPlayPromises.append(WTFMove(promise)); … … 3533 3533 } 3534 3534 if (processingUserGestureForMedia()) 3535 removeBehavior sRestrictionsAfterFirstUserGesture();3535 removeBehaviorRestrictionsAfterFirstUserGesture(); 3536 3536 3537 3537 playInternal(); … … 3634 3634 3635 3635 if (processingUserGestureForMedia()) 3636 removeBehavior sRestrictionsAfterFirstUserGesture(MediaElementSession::RequireUserGestureToControlControlsManager);3636 removeBehaviorRestrictionsAfterFirstUserGesture(MediaElementSession::RequireUserGestureToControlControlsManager); 3637 3637 3638 3638 pauseInternal(); … … 3745 3745 #if !PLATFORM(IOS_FAMILY) 3746 3746 if (volume && processingUserGestureForMedia()) 3747 removeBehavior sRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager);3747 removeBehaviorRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager); 3748 3748 3749 3749 m_volume = volume; … … 3784 3784 if (mutedStateChanged || !m_explicitlyMuted) { 3785 3785 if (processingUserGestureForMedia()) { 3786 removeBehavior sRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager);3786 removeBehaviorRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager); 3787 3787 3788 3788 if (hasAudio() && muted) … … 5879 5879 ALWAYS_LOG(LOGIDENTIFIER); 5880 5880 if (processingUserGestureForMedia()) 5881 removeBehavior sRestrictionsAfterFirstUserGesture();5881 removeBehaviorRestrictionsAfterFirstUserGesture(); 5882 5882 m_mediaSession->showPlaybackTargetPicker(); 5883 5883 } … … 5917 5917 { 5918 5918 DEBUG_LOG(LOGIDENTIFIER, event.type()); 5919 5920 if (m_removedBehaviorRestrictionsAfterFirstUserGesture && event.type() == eventNames().endedEvent) 5921 document().userActivatedMediaFinishedPlaying(); 5919 5922 5920 5923 HTMLElement::dispatchEvent(event); … … 7208 7211 #endif 7209 7212 7210 void HTMLMediaElement::removeBehavior sRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask)7213 void HTMLMediaElement::removeBehaviorRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask) 7211 7214 { 7212 7215 MediaElementSession::BehaviorRestrictions restrictionsToRemove = mask & … … 7222 7225 | MediaElementSession::InvisibleAutoplayNotPermitted 7223 7226 | MediaElementSession::RequireUserGestureToControlControlsManager); 7227 7228 m_removedBehaviorRestrictionsAfterFirstUserGesture = true; 7224 7229 7225 7230 m_mediaSession->removeBehaviorRestriction(restrictionsToRemove); -
trunk/Source/WebCore/html/HTMLMediaElement.h
r245039 r245467 563 563 const Logger& logger() const final { return *m_logger.get(); } 564 564 const void* logIdentifier() const final { return m_logIdentifier; } 565 const char* logClassName() const final { return "HTMLMediaElement"; } 565 566 WTFLogChannel& logChannel() const final; 566 567 #endif … … 852 853 void changeNetworkStateFromLoadingToIdle(); 853 854 854 void removeBehavior sRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask = MediaElementSession::AllRestrictions);855 void removeBehaviorRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask = MediaElementSession::AllRestrictions); 855 856 856 857 void updateMediaController(); … … 943 944 944 945 #if !RELEASE_LOG_DISABLED 945 const char* logClassName() const final { return "HTMLMediaElement"; }946 947 946 const void* mediaPlayerLogIdentifier() final { return logIdentifier(); } 948 947 const Logger& mediaPlayerLogger() final { return logger(); } … … 1202 1201 bool m_isPlayingToWirelessTarget { false }; 1203 1202 bool m_playingOnSecondScreen { false }; 1203 bool m_removedBehaviorRestrictionsAfterFirstUserGesture { false }; 1204 1204 }; 1205 1205 -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r237266 r245467 319 319 ExceptionOr<void> HTMLVideoElement::webkitEnterFullscreen() 320 320 { 321 LOG(Media, "HTMLVideoElement::webkitEnterFullscreen(%p)", this);321 ALWAYS_LOG(LOGIDENTIFIER); 322 322 if (isFullscreen()) 323 323 return { }; … … 334 334 void HTMLVideoElement::webkitExitFullscreen() 335 335 { 336 LOG(Media, "HTMLVideoElement::webkitExitFullscreen(%p)", this);336 ALWAYS_LOG(LOGIDENTIFIER); 337 337 if (isFullscreen()) 338 338 exitFullscreen(); … … 444 444 void HTMLVideoElement::webkitSetPresentationMode(VideoPresentationMode mode) 445 445 { 446 LOG(Media, "HTMLVideoElement::webkitSetPresentationMode(%p) - %d", this, mode);446 ALWAYS_LOG(LOGIDENTIFIER, mode); 447 447 setFullscreenMode(toFullscreenMode(mode)); 448 448 } … … 484 484 { 485 485 if (mode != fullscreenMode()) { 486 LOG(Media, "HTMLVideoElement::fullscreenModeChanged(%p) - mode changed from %i to %i", this, fullscreenMode(), mode);486 ALWAYS_LOG(LOGIDENTIFIER, "changed from ", fullscreenMode(), ", to ", mode); 487 487 scheduleEvent(eventNames().webkitpresentationmodechangedEvent); 488 488 } -
trunk/Source/WebCore/html/MediaElementSession.cpp
r245199 r245467 243 243 return; 244 244 245 INFO_LOG(LOGIDENTIFIER, "remov ing", restrictionNames(m_restrictions & restriction));245 INFO_LOG(LOGIDENTIFIER, "removed ", restrictionNames(m_restrictions & restriction)); 246 246 m_restrictions &= ~restriction; 247 247 }
Note: See TracChangeset
for help on using the changeset viewer.