Skip to content

Commit cb1719a

Browse files
Zaggy1024gmta
authored andcommitted
LibWeb: Don't loop the media element when paused
We should be able to seek to the end of the media without looping if we're paused. See: whatwg/html#11774
1 parent 4471e8c commit cb1719a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Libraries/LibWeb/HTML/HTMLMediaElement.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,13 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::play_element()
16261626
// notify about playing for the element.
16271627
else {
16281628
notify_about_playing();
1629+
1630+
// AD-HOC: If the official playback position is at the end of the media data here, that means that we haven't
1631+
// run the reached the end of media playback steps. This can happen if we seeked to the end while paused
1632+
// and looping.
1633+
// See https://github.com/whatwg/html/issues/11774
1634+
if (m_official_playback_position == m_duration)
1635+
reached_end_of_media_playback();
16291636
}
16301637
}
16311638

@@ -2033,7 +2040,10 @@ void HTMLMediaElement::reached_end_of_media_playback()
20332040
m_loop_was_specified_when_reaching_end_of_media_resource = has_attribute(HTML::AttributeNames::loop);
20342041
if (m_loop_was_specified_when_reaching_end_of_media_resource) {
20352042
// then seek to the earliest possible position of the media resource and return.
2036-
seek_element(0);
2043+
// AD-HOC: We don't want to loop back to the start if we're paused.
2044+
// See https://github.com/whatwg/html/issues/11774
2045+
if (!paused())
2046+
seek_element(0);
20372047
// FIXME: Tell PlaybackManager that we're looping to allow data providers to decode frames ahead when looping
20382048
// and remove any delay in displaying the first frame again.
20392049
return;

0 commit comments

Comments
 (0)