w3c / media-source

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

Use internal slots for various MediaSource and SourceBuffer object state #295

Closed wolenetz closed 2 years ago

wolenetz commented 2 years ago

Note, track buffers and their internal state remain as "variables", not internal slots, in the spec for now. Later refactoring might make them internal slots too, though at lower priority.

This partially fixes #286


Preview | Diff

wolenetz commented 2 years ago

@tidoust / @mwatson2 - Am I correct that the current external reference by the BSF Registry of generate timestamps flag via the helpers in media-source.js would be more stable if instead that registry used xref to reference the media-source spec, and {{SourceBuffer/[[generate timestamps flag]]}} respec syntax to reference the definition of that internal slot? For now at least, I think I've updated media-source.js in this PR to use the updated fragment for this former variable that is now an internal slot.

Also, please review soon if you could, as rebasing this could get ugly since it touches quite a number of lines. Thanks!

wolenetz commented 2 years ago

@mwatson2 - please take a look, or is @tidoust's prior approval sufficient? Thanks!

wolenetz commented 2 years ago

Looks good! The only thing I noticed - which exists in the pre-existing text and so is not a comment on this PR - is that some of these variables have explicitly stated types (boolean / TimeRanges) and some do not.

Thanks for the review. I too noticed some types missing. Some are simple, others like the "track buffer" concept have less strongly typed information, as it is left more to implementations. Possibly this is an area of improvement in the spec though, especially if things like buffered media introspection API is landed (where the notion of an app-visible "track buffer" object might make sense -- I've added a note around this to #259 ). - Edit: and I've also filed #297