Changeset 293609 in webkit
- Timestamp:
- Apr 29, 2022 12:57:59 AM (3 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/mediastream/video-mediastream-restricted-invisible-autoplay-not-allowed-expected.txt (added)
-
LayoutTests/fast/mediastream/video-mediastream-restricted-invisible-autoplay-not-allowed.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r293603 r293609 1 2022-04-29 Youenn Fablet <youenn@apple.com> 2 3 HTMLMediaElement can get multiple interruptions for invisible autoplay 4 https://bugs.webkit.org/show_bug.cgi?id=239842 5 <rdar://91809550> 6 7 Reviewed by Eric Carlson. 8 9 * fast/mediastream/video-mediastream-restricted-invisible-autoplay-not-allowed-expected.txt: Added. 10 * fast/mediastream/video-mediastream-restricted-invisible-autoplay-not-allowed.html: Added. 11 1 12 2022-04-28 Patrick Griffis <pgriffis@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r293607 r293609 1 2022-04-29 Youenn Fablet <youenn@apple.com> 2 3 HTMLMediaElement can get multiple interruptions for invisible autoplay 4 https://bugs.webkit.org/show_bug.cgi?id=239842 5 <rdar://91809550> 6 7 Reviewed by Eric Carlson. 8 9 A media element may be interrupted for invisible autoplay. 10 In some cases, like by calling play on the media element, the media element will no longer be in interrupted state. 11 This will lead to multiple invisible autoplay interruptions to be added to the same media element. 12 There will be only one end of interruption for invisible autoplay, which will lead to the media element to not restart as expected. 13 14 To prevent this, we store a boolean in HTMLMediaElement that tells us whether the media element has an ongoing invisible autoplay interruption. 15 Based on that, we make sure to always balance invisible autoplay interruption begin and end. 16 17 Test: media/video-mediastream-restricted-invisible-autoplay-not-allowed.html 18 19 * html/HTMLMediaElement.cpp: 20 * html/HTMLMediaElement.h: 21 1 22 2022-04-29 Youenn Fablet <youenn@apple.com> 2 23 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r293488 r293609 8380 8380 8381 8381 if (canAutoplay) { 8382 if (mediaSession().state() == PlatformMediaSession::Interrupted) { 8383 if (mediaSession().interruptionType() == PlatformMediaSession::InvisibleAutoplay) 8384 mediaSession().endInterruption(PlatformMediaSession::MayResumePlaying); 8385 } else if (!isPlaying()) 8382 if (m_wasInterruptedForInvisibleAutoplay) { 8383 m_wasInterruptedForInvisibleAutoplay = false; 8384 mediaSession().endInterruption(PlatformMediaSession::MayResumePlaying); 8385 return; 8386 } 8387 if (!isPlaying()) 8386 8388 resumeAutoplaying(); 8387 8389 return; 8388 8390 } 8389 if (mediaSession().state() != PlatformMediaSession::Interrupted) 8390 mediaSession().beginInterruption(PlatformMediaSession::InvisibleAutoplay); 8391 8392 if (mediaSession().state() == PlatformMediaSession::Interrupted) 8393 return; 8394 8395 if (m_wasInterruptedForInvisibleAutoplay) { 8396 m_wasInterruptedForInvisibleAutoplay = false; 8397 mediaSession().endInterruption(PlatformMediaSession::NoFlags); 8398 } 8399 8400 m_wasInterruptedForInvisibleAutoplay = true; 8401 mediaSession().beginInterruption(PlatformMediaSession::InvisibleAutoplay); 8391 8402 } 8392 8403 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r292585 r293609 1249 1249 AudioSessionCategory m_categoryAtMostRecentPlayback; 1250 1250 #endif 1251 bool m_wasInterruptedForInvisibleAutoplay { false }; 1251 1252 }; 1252 1253
Note: See TracChangeset
for help on using the changeset viewer.