Bug 247602 - [MSE] Should not seek with no seekable range
Summary: [MSE] Should not seek with no seekable range
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yousuke Kimoto
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-07 20:09 PST by Yousuke Kimoto
Modified: 2022-11-16 17:24 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuke Kimoto 2022-11-07 20:09:57 PST
"Seek" cannot be handled when there is no seekable range, but the current implementation,

https://github.com/WebKit/WebKit/blob/main/Source/WebCore/html/HTMLMediaElement.cpp#L3510
#if ENABLE(MEDIA_SOURCE)
    // Always notify the media engine of a seek if the source is not closed. This ensures that the source is
    // always in a flushed state when the 'seeking' event fires.
    if (m_mediaSource && !m_mediaSource->isClosed())
        noSeekRequired = false;
#endif

"noSeekRequired" is set with "false" even if seekableRanges' length is ZERO.

    bool noSeekRequired = !seekableRanges->length();

According to HTML media seeking spec,

https://html.spec.whatwg.org/multipage/media.html#seeking
8. If the (possibly now changed) new playback position is not in one of the ranges given in the seekable attribute, then let it be the position in one of the ranges given in the seekable attribute that is the nearest to the new playback position. If two positions both satisfy that constraint (i.e. the new playback position is exactly in the middle between two ranges in the seekable attribute) then use the position that is closest to the current playback position. If there are no ranges given in the seekable attribute then set the seeking IDL attribute to false and return.

So the length of seekableRanges should be checked to set "false" to noSeekRequired.

This will fix an issue where HTMLMediaElement.duration is Infinity while playing live streaming videos. Sine HTMLMediaElement.duration == Infinity, there is no seekable range. In this case, seeking should be aboted.

Related links:
- Issue 461733: MSE - cannot seek when video.duration set to Infinity
  https://bugs.chromium.org/p/chromium/issues/detail?id=461733
- Seekable differs from non-MSE behavior #5
  https://github.com/w3c/media-source/issues/5
Comment 1 Yousuke Kimoto 2022-11-08 00:17:24 PST
Pull request: https://github.com/WebKit/WebKit/pull/6242
Comment 2 Yousuke Kimoto 2022-11-09 20:14:19 PST
Related Ticket:
 Bug 139139 [MSE] Fix not always calling mediaPlayer seek.
Comment 3 Radar WebKit Bug Importer 2022-11-14 20:10:17 PST
<rdar://problem/102350111>
Comment 4 EWS 2022-11-16 17:24:56 PST
Committed 256759@main (ab539817a721): <https://commits.webkit.org/256759@main>

Reviewed commits have been landed. Closing PR #6242 and removing active labels.