Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c782c456f8ed7fcd7132b1a111e705324be386c8
https://github.com/WebKit/WebKit/commit/c782c456f8ed7fcd7132b1a111e705324be386c8
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-21 (Tue, 21 Jul 2026)
Changed paths:
A
LayoutTests/http/tests/media/hls/hls-live-playbackrate-no-ended-expected.txt
A LayoutTests/http/tests/media/hls/hls-live-playbackrate-no-ended.html
M
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
Log Message:
-----------
Wrong ended event fired on HLS live stream when dealing with playbackRate
https://bugs.webkit.org/show_bug.cgi?id=245519
rdar://100556746
Reviewed by Jean-Yves Avenard.
A live HLS stream reports an unbounded duration (positive infinity), which is
how WebKit recognizes it as live. When such a stream is played forward into the
live edge, AVFoundation posts AVPlayerItemDidPlayToEndTimeNotification, which
routes into MediaPlayerPrivateAVFoundation::didEnd(). That method caches the
current time as the media's duration to correct estimated durations. For a live
stream this demotes the duration from positive infinity to a finite value, so
the next HTMLMediaElement::handlePlaybackPositionChanged() sees currentTime at
the (now finite) duration and fires a spurious pause and ended, even though the
stream has not finished. Changing playbackRate makes this easy to hit because
playback reaches the live edge sooner.
Skip caching the duration in didEnd() when the resource is a live stream, so its
unbounded duration is preserved and endedPlayback() does not treat reaching the
live edge as the end of the media. Also log isLiveStream() in didEnd() to make
this state visible for future diagnosis.
Test: http/tests/media/hls/hls-live-playbackrate-no-ended.html
* LayoutTests/http/tests/media/hls/hls-live-playbackrate-no-ended-expected.txt:
Added.
* LayoutTests/http/tests/media/hls/hls-live-playbackrate-no-ended.html: Added.
*
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::didEnd):
Canonical link: https://commits.webkit.org/317626@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications