w3c / media-source

Media Source Extensions
https://w3c.github.io/media-source/
Other
267 stars 57 forks source link

endOfStream() prior to HAVE_METADATA is not defined well #212

Open wolenetz opened 6 years ago

wolenetz commented 6 years ago

In Chrome, endOfStream() (either no parameter, 'network', or 'decode) results with the attached HTMLMediaElement's error attribute becoming populated with a MediaError object: {code: 4, message: "DEMUXER_ERROR_COULD_NOT_OPEN"} (4 is MEDIA_ERR_SRC_NOT_SUPPORTED).

This is because Chrome assumes that any attempt to endOfStream() a MediaSource before its attached HTMLMediaElement has reached HAVE_METADATA means that there is not enough metadata to consider any of it renderable, so follows the endOfStream('decode') steps:

If the HTMLMediaElement.readyState attribute equals HAVE_NOTHING Run the "If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all" steps of the resource fetch algorithm's media data processing steps list.

But the endOfStream([no error]) steps for MSE don't consider the media element's readyState like this. Rather, they say to:

[update duration, then] Notify the media element that it now has all of the media data. [regardless of parent's media element's readyState]

This issue is purely to determine what is the right route forward (does Chrome have a bug, or does the spec, or both?)

wolenetz commented 5 years ago

Note, this is still an active issue. I suggest adding a note to MSE vNext spec formalizing that endOfStream() prior to media element having reached HAVE_METADATA should result in steps akin to endOfStream('decode').

wolenetz commented 3 years ago

Looks to me like a spec bugfix in scope for V2.