w3c / media-source

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

MSE-in-Workers: Consider adding a "closing" readyState to explain new `InvalidStateError` exception when closing underway #276

Open wolenetz opened 3 years ago

wolenetz commented 3 years ago

MSE-in-Workers feature issue is #175

This issue tracks discussing an additional readyState usable by apps to understand when a worker MediaSource object is in the process of being closed or detached-from by the formerly-attached HTMLMediaElement. Implementations may choose to throw InvalidStateError exception when servicing requests on a worker-owned MediaSource or SourceBuffer that require readyState to not be closed, yet the implementation has begun but not yet fully completed the steps involved in reaching closed readyState.

For example, setting the mode attribute of a SourceBuffer requires essentially that the parent MediaSource not be closed nor updating. But if it knows that it will be closing imminently due to some internal notification from the implementation of its attachment to HTMLMediaElement, then it may throw exception. Having a distinct readyState for this scenario would assist worker API usage debugging (see an example of such at https://github.com/w3c/media-source/issues/175#issuecomment-742132101).