w3c / media-source

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

By HTML 5.1 spec, the mediasource should never be detached from the media element #162

Open jyavenard opened 7 years ago

jyavenard commented 7 years ago

I lodged a test bug in https://github.com/w3c/web-platform-tests/issues/3726

However, I do believe that we have a problem in the MSE specs themselves.

According to the spec, we are to detach the mediasource from the media element when the element's networkState moves to NETWORK_EMPTY (ref: https://w3c.github.io/media-source/index.html#mediasource-detach)

However, following the HTML spec, we will never transition to NETWORK_EMPTY with mediasource, as the only time this can occur is

"⌛ Otherwise the media element has no assigned media provider object and has neither a src attribute nor a source element child: set the networkState to NETWORK_EMPTY, and abort these steps; the synchronous section ends." https://html.spec.whatwg.org/multipage/embedded-content.html#concept-media-load-algorithm

or "If the media data fetching process is aborted by the user".

And if an error occurs during the resource selection algorithm, then we are to run

"The dedicated media source failure steps with a list of promises promises are the following steps:

  1. Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_SRC_NOT_SUPPORTED.
  2. Forget the media element's media-resource-specific tracks.
  3. Set the element's networkState attribute to the NETWORK_NO_SOURCE value.
  4. Set the element's show poster flag to true.
  5. Fire a simple event named error at the media element.
  6. Reject pending play promises with promises and a "NotSupportedError" DOMException.
  7. Set the element's delaying-the-load-event flag to false. This stops delaying the load event. "

so here networkState goes to NETWORK_NO_SOURCE

So I'm puzzled on what the proper course of action should be or the wording...

wolenetz commented 3 years ago

This looks at least like a bugfix is needed in V2.