Skip to content

Commit 78ce372

Browse files
committed
Unreviewed, reverting 287274@main (71a7e0a)
https://bugs.webkit.org/show_bug.cgi?id=285568 rdar://142517488 Broke duolingo, calling play() during a seek() is allowed by the spec. And the play event should be fired even if the seek hasn't completed. Reverted change: [Media] Avoid play() call during seek flow before the finishSeek() https://bugs.webkit.org/show_bug.cgi?id=283172 287274@main (71a7e0a) Canonical link: https://commits.webkit.org/288588@main --- Revert "[Media] Avoid play() call during seek flow before the finishSeek()" This reverts commit 6e84da2. See upstream revert: https://bugs.webkit.org/show_bug.cgi?id=285568 See downstream discussion: #1423
1 parent 9b71229 commit 78ce372

2 files changed

Lines changed: 3 additions & 26 deletions

File tree

Source/WebCore/html/HTMLMediaElement.cpp

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,10 +3212,6 @@ void HTMLMediaElement::seekWithTolerance(const MediaTime& inTime, const MediaTim
32123212
refreshCachedTime();
32133213
MediaTime now = currentMediaTime();
32143214

3215-
// Needed to detect a special case in updatePlayState().
3216-
if (now >= durationMediaTime())
3217-
m_seekAfterPlaybackEnded = true;
3218-
32193215
// 3 - If the element's seeking IDL attribute is true, then another instance of this algorithm is
32203216
// already running. Abort that other instance of the algorithm without waiting for the step that
32213217
// it is running to complete.
@@ -3387,8 +3383,6 @@ void HTMLMediaElement::finishSeek()
33873383
#endif
33883384
if (wasPlayingBeforeSeeking)
33893385
playInternal();
3390-
3391-
m_seekAfterPlaybackEnded = false;
33923386
}
33933387

33943388
HTMLMediaElement::ReadyState HTMLMediaElement::readyState() const
@@ -3810,10 +3804,8 @@ void HTMLMediaElement::playInternal()
38103804
if (!m_player || m_networkState == NETWORK_EMPTY)
38113805
selectMediaResource();
38123806

3813-
if (endedPlayback()) {
3814-
m_seekAfterPlaybackEnded = true;
3807+
if (endedPlayback())
38153808
seekInternal(MediaTime::zeroTime());
3816-
}
38173809

38183810
if (m_mediaController)
38193811
m_mediaController->bringElementUpToSpeed(*this);
@@ -5776,17 +5768,7 @@ void HTMLMediaElement::updatePlayState()
57765768
if (shouldBePlaying) {
57775769
invalidateCachedTime();
57785770

5779-
// Play is always allowed, except when seeking (to avoid unpausing the video by mistake until the
5780-
// target time is reached). However, there are some exceptional situations when we allow playback
5781-
// during seek. This is because GStreamer-based implementation have a design limitation that doesn't
5782-
// allow initial seeks (seeking before going to playing state), and these exceptions make things
5783-
// work for those platforms.
5784-
bool isLooping = loop() && m_lastSeekTime == MediaTime::zeroTime();
5785-
bool playExceptionsWhenSeeking = m_seeking && (m_firstTimePlaying
5786-
|| isLooping || m_isResumingPlayback || m_seekAfterPlaybackEnded);
5787-
bool allowPlay = !m_seeking || playExceptionsWhenSeeking;
5788-
5789-
if (playerPaused && allowPlay) {
5771+
if (playerPaused) {
57905772
mediaSession().clientWillBeginPlayback();
57915773

57925774
// Set rate, muted and volume before calling play in case they were set before the media engine was set up.
@@ -8131,11 +8113,8 @@ void HTMLMediaElement::resumeAutoplaying()
81318113
void HTMLMediaElement::mayResumePlayback(bool shouldResume)
81328114
{
81338115
ALWAYS_LOG(LOGIDENTIFIER, "paused = ", paused());
8134-
if (paused() && shouldResume) {
8135-
m_isResumingPlayback = true;
8116+
if (paused() && shouldResume)
81368117
play();
8137-
m_isResumingPlayback = false;
8138-
}
81398118
}
81408119

81418120
String HTMLMediaElement::mediaSessionTitle() const

Source/WebCore/html/HTMLMediaElement.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,6 @@ class HTMLMediaElement
11621162
bool m_shouldAudioPlaybackRequireUserGesture : 1;
11631163
bool m_shouldVideoPlaybackRequireUserGesture : 1;
11641164
bool m_volumeLocked : 1;
1165-
bool m_isResumingPlayback : 1 { false };
1166-
bool m_seekAfterPlaybackEnded : 1 { false };
11671165

11681166
AutoplayEventPlaybackState m_autoplayEventPlaybackState { AutoplayEventPlaybackState::None };
11691167

0 commit comments

Comments
 (0)