Media Chrome state management with no src #288
Replies: 4 comments 12 replies
-
Beta Was this translation helpful? Give feedback.
-
This seems like something we should be able to solve regardless of the rest of this discussion. We should be able to handle the play promise being rejected and then resetting the state appropriately. |
Beta Was this translation helpful? Give feedback.
-
Doing more digging into the empty src details
There's multiple chrome bugs and a safari bug in there that should be reported. Good job Firefox! I don't think the preload=none issues are media-chrome's job to solve. I think we:
Assuming that detail is solved in one or all of those ways, we can then focus on the specific workflow of "Player is created before the live stream is ready, and viewer is sitting there waiting and probably clicking everything they can". |
Beta Was this translation helpful? Give feedback.
-
Yeah maybe it's a gap in the spec, but there's unexpected behavior that's inconsistent with other browsers, so that's worth reporting. If it hasn't already been reported it's a good sign this isn't a big issue in practice. The preload=none case specifically. |
Beta Was this translation helpful? Give feedback.
-
The Problem
Currently, some Media Chrome controls will have unexpected behavior, including throwing errors, if either:
src
has not been setreadyState
)Some concrete examples:
src
has not been set and the media's metadata hasn't been loaded, if you attempt to enter picture in picture mode (e.g. via the<media-pip-button/>
), an error will be thrown.src
has not been set, if you attempt to play (e.g. via the<media-play-button>
), the slotted media element will dispatch awaiting
event, suggesting the media is loading, and aplay
event, resulting in the<media-play-button/>
showing the pause icon.preload="metadata"
orpreload="auto"
, playback will begin once thesrc
is setpreload="none"
, theplay()
promise will be rejected and it will still look like the media is loading (and the<media-play-button/>
will still show the pause icon)<media-play-button/>
), playback will begin.load()
the media, the slotted media element will go back to apaused
state.src
has not been set and the media's metadata hasn't been loaded, if you attempt to seek via the<media-time-range/>
, slotted media element'scurrentTime
will remain unchanged, however the thumb position will look as if it has until atimeupdate
orloadedmetadata
event is dispatched.Possible Broad Strokes Solutions (not mutually exclusive)
<media-controller/>
's state management based on the slotted media element'ssrc
state andreadyState
<media-controller/>
(potentially asynchronously) even if there is no corresponding event under conditions where we know the state will not update (for e.g. the<media-time-range/>
case, described above).src
andreadyState
or something derivable from them as attributes/properties of<media-controller/>
's state management and provide them to the relevant controls.Recommendation
I believe we should do all three, but not "bake in" any disabling CSS (at least for now, since we can decide to add that later).
For (1), we should minimally guarantee that state request events that throw errors should be "gated". Also, (1) will already need to be keeping track of the state described in (3) in
<media-controller/>
.For (2), I think we should minimally guarantee that our controllers accurately reflect the media's state. Our general control/display element ("Media State Receivers") architecture is based on having their state provided to them from the "outside" (via the
<media-controller/>
's media state management). The only reason this is an issue for things like the<media-time-range/>
is because we're relying on an inherently stateful element "under the hood" (an<input type="range"/>
), so we need to effectively "renotify" the element that the state is exactly what it was before interaction. Also, as with (1), (2) will already need to be keeping track of some of the state described in (3) in<media-controller/>
.For (3), aside from its partial relationships to (1) and (2), providing these new state attributes will allow us or implementors to disable controls when their actions will not succeed or will result in different behaviors based on order of operations.
There are at least two outstanding details that will need to be decided if we implement (3).
src
andreadyState
directly, or do we want to model them as something more specific (e.g.media-has-src
,media-has-metadata
)? (I lean towards the former, but only slightly for versatility/future usage/less presumption on was the state would/could be used. Given the fact that implementors will likely use these attributes for CSS selectors, however, I can see the merit of clearer, derived values like the example I provided in the latter.)Beta Was this translation helpful? Give feedback.
All reactions