Establish Conventions for (Un)supported and (Un)available states. #134
Replies: 5 comments 9 replies
-
Depended on/relates to #135 |
Beta Was this translation helpful? Give feedback.
-
I like the use of an attribute for this. That's very targetable, and flexible. You could choose to handle that at the player level, control-bar, the button itself. What's an example of where we'd want to handle unavailable differently from unsupported, or could we combine them into one? |
Beta Was this translation helpful? Give feedback.
-
detecting if volume is available is (horribly) async now on mobile safari 15 (see our slack for a discussion on this silliness). If we don't account for that, we will have the possibility of an ugly initial render situation (either show then quickly hide volume slider or hide then quickly show it) 😞. I do personally think our "default"/no attr situation should be "available" (+ implicitly supported, I'm assuming), regardless of any of the other details. This would allows us to assume "status quo" for the base case/absence of a variable (e.g. our example pages with just the buttons).
If this is clunky, we could certainly still move forward with "collapsing" supported/available into a single value "available" (since available implies supported and unsupported implies unavailable). If we stuck with my above proposals, that would mean either the 3-state option, which is my S1 (e.g.):
or the 2-state option
|
Beta Was this translation helpful? Give feedback.
-
I think the biggest point of contention remaining is including or excluding the "unknown" state. Everything else is feels like details I'm comfortable deferring to you for whatever you prefer. One callout I'll highlight but still would defer to you is the OS detection proposal: previously, you expressed concerns about building in user agent/OS detection because it can easily become a "can of worms." Just want to make sure that original concern/risk is being weighed in the proposal. FWIW It doesn't feel like it would be necessary if we agree to including "unknown" somehow. Here's how I see the value of "unknown". Not sure if this is a "me thing", but I personally dislike interfaces/apis that
|
Beta Was this translation helpful? Give feedback.
-
Another callout specific to airplay: |
Beta Was this translation helpful? Give feedback.
-
There are several states/properties that may be unsupported or unavailable in a given use case/environment for media chrome. The purpose of this discussion is to establish a convention for naming and managing these two scenarios.
Overview
Categories
(Un)supported
These are states/features and the like that are unavailable or cannot be changed within a given runtime/execution environment. Conceptually at least, these should only need to be checked once and should never change within a runtime. Since these may be asynchronous, we may want/need to distinguish between three different states:
We could assume either supported/unsupported (generally or on a case by case basis), though this may add complexity if things like show/hide or enabled/disabled states/styles for particular components are being driven by these values.
Examples:
(Un)available
These are states/features and the like that are supported but are currently unavailable based on details of the media content or other environmental factors. These can change dynamically, including for a particular instance of a
media-controller
and/or slottedmedia
. Since these may be asynchronous, we may want/need to distinguish between three different states:We could assume either available/unavailable (generally or on a case by case basis), though this may add complexity if things like show/hide or enabled/disabled states/styles for particular components are being driven by these values.
Examples:
media.textTracks
dynamically updated. Conceptually at least, this could be accounted for based on having an emptyMEDIA_CAPTIONS_LIST
/MEDIA_SUBTITLES_LIST
, respectively)Convention Proposals
This is just a starting proposal but I'm open to alternatives as long as they capture the relevant cases and communicate effectively.
General
If the corresponding attribute is absent on a given media state receiver/component, that component should "assume" the relevant state/feature is supported or available. This allows implementations and "out of the box" examples to render/behave/style "as if" something is available, treating unsupported/unavailable (and potentially corresponding unknown states)
Proposal 1 - simple 2 state boolean
[state]-unsupported
[state]-unavailable
Boolean attribute convention: if
hasAttribute()
, implies unsupported/unavailable, otherwise supported/available . Value should be empty string (""
) by convention.Examples:
captions-unavailable
airplay-unsupported
volume-unsupported
Proposal 2 - 3 state
[state]-support
("UNKNOWN"|"UNSUPPORTED"
)[state]-availability
("UNKNOWN"|"UNAVAILABLE"
)Default attribute value convention: if
!hasAttribute()
, implies supported/availableWe may also consider the 3rd state (
"SUPPORTED"
/"AVAILABLE"
) as valid explicit values, where!hasAttribute()
maps to"SUPPORTED"
/"AVAILABLE"
more explicitly.Beta Was this translation helpful? Give feedback.
All reactions