mediacapture-image icon indicating copy to clipboard operation
mediacapture-image copied to clipboard

Enforcing user gesture for getUserMedia in case of PTZ request

Open youennf opened this issue 4 years ago • 6 comments

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.

youennf avatar Aug 27 '20 08:08 youennf

LGTM

@jan-ivar @alvestrand any objections?

beaufortfrancois avatar Aug 31 '20 07:08 beaufortfrancois

(gentle ping)

@jan-ivar @alvestrand @guidou for thoughts

beaufortfrancois avatar Sep 24 '20 13:09 beaufortfrancois

@youennf is this something you think we need to address before wide review?

jan-ivar avatar Apr 12 '21 15:04 jan-ivar

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.

youennf avatar Apr 12 '21 15:04 youennf

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.

eehakkin avatar May 04 '21 17:05 eehakkin

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.

youennf avatar May 05 '21 08:05 youennf