Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 3 additions & 24 deletions Source/WebCore/html/HTMLMediaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3747,10 +3747,6 @@ void HTMLMediaElement::seekWithTolerance(const SeekTarget& target, bool fromDOM)
refreshCachedTime();
MediaTime now = currentMediaTime();

// Needed to detect a special case in updatePlayState().
if (now >= durationMediaTime())
m_seekAfterPlaybackEnded = true;

// 3 - If the element's seeking IDL attribute is true, then another instance of this algorithm is
// already running. Abort that other instance of the algorithm without waiting for the step that
// it is running to complete.
Expand Down Expand Up @@ -3938,8 +3934,6 @@ void HTMLMediaElement::finishSeek()
#endif
if (wasPlayingBeforeSeeking)
playInternal();

m_seekAfterPlaybackEnded = false;
}

HTMLMediaElement::ReadyState HTMLMediaElement::readyState() const
Expand Down Expand Up @@ -4377,10 +4371,8 @@ void HTMLMediaElement::playInternal()
if (!m_player || m_networkState == NETWORK_EMPTY)
selectMediaResource();

if (endedPlayback()) {
m_seekAfterPlaybackEnded = true;
if (endedPlayback())
seekInternal(MediaTime::zeroTime());
}

if (RefPtr mediaController = m_mediaController)
mediaController->bringElementUpToSpeed(*this);
Expand Down Expand Up @@ -6366,17 +6358,7 @@ void HTMLMediaElement::updatePlayState()
if (shouldBePlaying) {
invalidateCachedTime();

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

if (playerPaused && allowPlay) {
if (playerPaused) {
mediaSession().clientWillBeginPlayback();

// Set rate, muted and volume before calling play in case they were set before the media engine was set up.
Expand Down Expand Up @@ -8927,11 +8909,8 @@ void HTMLMediaElement::resumeAutoplaying()
void HTMLMediaElement::mayResumePlayback(bool shouldResume)
{
ALWAYS_LOG(LOGIDENTIFIER, "paused = ", paused());
if (!ended() && paused() && shouldResume) {
m_isResumingPlayback = true;
if (!ended() && paused() && shouldResume)
play();
m_isResumingPlayback = false;
}
}

String HTMLMediaElement::mediaSessionTitle() const
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/html/HTMLMediaElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,6 @@ class HTMLMediaElement
bool m_volumeLocked : 1;
bool m_cachedIsInVisibilityAdjustmentSubtree : 1 { false };
bool m_requiresTextTrackRepresentation : 1 { false };
bool m_isResumingPlayback : 1 { false };
bool m_seekAfterPlaybackEnded : 1 { false };

IntRect m_textTrackRepresentationBounds;

Expand Down