-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternate API design #15
Comments
I like this idea, because (1) it's consistent, and very clear to let developers know where they should ask for the result (no need to switch from different API interfaces) (2) it provides the flexibility of extending this API if we want to expose blocking autoplay to other elements. eg. web speech. The little drawback is that the output will not be consistent among different inputs. Eg. for web audio, Thank you. |
In addition, this proposal can solve my previous quesiton, because it provides the ability to directly check whether audio context can be allowed to play, instead of relying the result of If we want to follow this way, then we will need to mention that |
This may be fine, as WebAudio users will likely only expect |
I agree with @gkatsev. I don't know about precedent with other APIs, but it seems fine to me that we can spec that |
I still prefer this api existing on the object(s) it’s related too. What does having it as a separate api solve? Is it just so that there’s only one function then? I also don’t think we should allow |
Hi everyone, I just wanted to mention that |
Thanks Christoph, I hadn't seen that! |
It can help the inconsistent problem between document and webaudio. If we follow this new design, then we will explicitly mention that the result from document would only affect HTMLMediaElement, and for web audio, they should use new designed API to query the result. Although that can also be done in previous design, that means we would need to add a new API on
Why having I think the benefit of keeping the
If we want to extend the policy to other elements, we just need to simply add a different parameter, then it could help to answer the question.
Thank for mentioning that! It's good to know! |
Thanks. Makes sense to me.
Yeh using I also think you could get the same info that we’re proposing navigator.getAutoPlayPolicy(document.createElement(‘video’)); ? so maybe we don’t actually need to handle |
What about accepting the This would return the general policy for all media elements: navigator.getAutoPlayPolicy(HTMLMediaElement); And this would return the policy for a specific media element in the DOM: navigator.getAutoPlayPolicy(document.querySelector('#my-video')); Likewise this would return the general policy for any navigator.getAutoPlayPolicy(AudioContext); |
Yeh that looks quite intuitive to me. Accept an instance or the constructor |
Passing the constructor sounds good to me. I'd just like to avoid having to create a video element to know the default/current autoplay policy should a new video element be created. Also, can the function be capitalized like |
Christoph's proposal also sounds good to me, and I also want to avoid simply creating a dummy element to query the general policy for media elements. As most people seems all agreeing this proposal, if we don't get any disagreement in following few days, then I will create a new PR for that.
Sounds good to me as well. Thank y'all so much. |
@liberato-at-chromium @chcunningham do you have any thoughts on this proposal? |
Deferring to @liberato-at-chromium. |
query by constructor or object sgtm. really like it, in fact. |
I said during today's Media WG call that I would look into other occurrences of methods that take a constructor as parameter on the Web platform. I found a few examples which are all about "registering" something:
There may be more examples. There does not seem to be an easy way to get an exhaustive list automatically given the way such constructs are expressed in Web IDL. |
Hi, all, sorry for the delay. I just created a new PR for this new API design, and feel free to leave any suggestion there. Thank you. |
In yesterday's Media WG meeting, @jernoble suggested considering an alternate design: Instead of extending
document
,HTMLMediaElement
, andAudioContext
, could the API instead have a single method that accepts one of those as parameter and returns the appropriate autoplay policy for that object, so for example:cc @alastor0325 @liberato-at-chromium
The text was updated successfully, but these errors were encountered: