Closed Bug 1277729 Opened 8 years ago Closed 8 years ago

media element buffered range returning empty if readyState is HAVE_NOTHING

Categories

(Core :: Audio/Video: Playback, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jya, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

This can be seen in:
http://people.mozilla.org/~jyavenard/tests/mse_webm/youtube-durationlastframe.html

We have the following even listener on the source buffer:
    sourceBuffer.addEventListener('update', function(e){
      logger.log('* sourceBuffer.updateend');
      logger.log('sourceBuffer.buffered =' + printTimeRange(sourceBuffer.buffered));
      logger.log('video.duration=' + video.duration);
      logger.log('mediasource.duration = ' + mediaSource.duration);
      logger.log('video.buffered =' + printTimeRange(video.buffered));
    });

Yet, when it runs we see:
369: * sourceBuffer.updateend
370: sourceBuffer.buffered ={{ 0,5.072 }}
370: video.duration=70.07
370: mediasource.duration = 70.07
371: video.buffered ={}

the video.buffered attribute is empty, even though the sourcebuffer buffered attribute isn't.

per spec:
https://w3c.github.io/media-source/index.html#htmlmediaelement-extensions

the media element buffered attribute, should be directly related to the source buffer attribute.
https://dxr.mozilla.org/mozilla-central/source/dom/html/HTMLMediaElement.cpp#4739

If the readyState is HAVE_NOTHING then the buffered range will always be empty.

I see nothing in regards to this in the spec.
Summary: [MSE] media element buffered range returning empty even after updateend fired. → media element buffered range returning empty if readyState is HAVE_NOTHING
Chrome will report the buffered range as what's actually buffered even if the readyState is 0.
For plain media playback, the buffered range will always be empty if readyState is HAVE_NOTHING has we need to decode the metadata to determine the duration and eventually decode the first frame to determine the start time. With MSE however, the buffered range is per spec directly related to the source buffer buffered range.

So we can always simply query the MediaDecoder to determine the buffered range regardless of the readyState value.

Review commit: https://reviewboard.mozilla.org/r/57432/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/57432/
Attachment #8759447 - Flags: review?(jwwang)
Comment on attachment 8759447 [details]
Bug 1277729: Ignore readyState value when reporting the buffered range.

https://reviewboard.mozilla.org/r/57432/#review54228
Attachment #8759447 - Flags: review?(jwwang) → review+
Pushed by jyavenard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f75d7afd686e
Ignore readyState value when reporting the buffered range. r=jwwang
https://hg.mozilla.org/mozilla-central/rev/f75d7afd686e
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: