mediacapture-image
mediacapture-image copied to clipboard
Enforcing user gesture for getUserMedia in case of PTZ request
Following on https://github.com/w3c/mediacapture-main/issues/639, calling getUserMedia would ideally be gated by a user gesture. This is difficult to enforce it for regular getUserMedia calls due to existing usage of getUserMedia. But it might be possible to enforce it in case getUserMedia is requesting PTZ privilege, since this is a new feature.
LGTM
@jan-ivar @alvestrand any objections?
(gentle ping)
@jan-ivar @alvestrand @guidou for thoughts
@youennf is this something you think we need to address before wide review?
Given there is consensus there, what is missing is the editorial work.. I think it would be good to do so before wide review.
I guess this could be added directly to medicapture-image, in pan, tilt and zoom sections that talk about permission requests.
So how should this gating work? Should the descriptions of pan, tilt and zoom photo capabilities and constrainable properties be amended with text like
"The user agent MUST ignore any persisted granted permissions unless the document's Window object has transient activation."
The idea here is to align with the main spec which might get similar gating if https://github.com/w3c/mediacapture-extensions/issues/11 is resolved as @youennf suggested (https://github.com/w3c/mediacapture-extensions/issues/11#issuecomment-593307645) based on @alvestrand's and @jan-ivar 's comments.
In that is it would actually be that the persisted granted permissions (and not the getUserMedia calls per se) would be gated by a user gesture which is apparently called transient activation nowadays.
Given this is a new feature and that applications should opt-in, I do not think we have compat breakage by requiring transient activation. We could probably do like for getDisplayMedia: reject the promise if getUserMedia is called with any pan/tilt/zoom constraint and document does not have transient activation.