MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
451 stars 55 forks source link

Feature request: Device or permission "in use" event #2428

Open RendijsSmukulis opened 2 years ago

RendijsSmukulis commented 2 years ago

We currently have no good way to indicate to a user when some sensitive API is in use by a page, e.g. the page has access to the camera or the microphone that's currently recording.

It would be great to see an event that signals when these APIs are being actively used by site:

With events fired when these are enabled and then later disabled.

AB#39484085

victorthoang commented 2 years ago

Thanks for the feedback RendijsSmukulis! We've added this as a scenario on our backlog!

nishitha-burman commented 2 years ago

Hi @RendijsSmukulis,

Can you expand more on the scenario you are trying to achieve here? For these events is it sufficient to be able to query the value set for these permissions?

Thank you

q71114 commented 2 years ago

Hi @nishitha-burman

In this case we want to display an indicator to the user that a permission is in use AND we also want to give them the ability to pause / resume usage. This means apart from being able to query the value we need to be able to disable / re-enable the outgoing audio / video stream temporarily. For example at JS level this means setting MediaStreamTrack.enabled to false (and then back to true for resuming).

vickiez commented 1 year ago

@RendijsSmukulis and @q71114, can you check if the new experimental Permission Management APIs meet your needs? https://github.com/MicrosoftEdge/WebView2Feedback/issues/2427#issuecomment-1399097515 Thanks!

q71114 commented 1 year ago

@RendijsSmukulis and @q71114, can you check if the new experimental permission management APIs meet your needs? #2427 (comment) Thanks!

Hi @vickiez,

Thanks for the info, we'll check it out. Looking at the new APIs I don't see anything that provides "in use" status (eg. camera is recording). Are those APIs in a separate document?

vickiez commented 1 year ago

@q71114 we haven't added an "in use" event but you may be able to accomplish what you need in a couple ways:

Will either of these options work for your case?

q71114 commented 1 year ago

@vickiez thanks for the suggestion, but it doesn't offer enough support for all the cases that we want to cover I'm afraid.

We only display these "in use" indicators when they are actually being in use, so GetNonDefaultPermissionSettings won't work.

Using PermissionRequested with SavesInProfile property won't cover everything either because for example audio / video streams can be paused (muted) and they don't trigger PermissionRequested event, which is fine because they are not new request, but we still need to be able to display proper "in use" statuses for those scenarios. You can check it out here: https://jsfiddle.net/jib1/3ykab1e2/39/

vickiez commented 1 year ago

I see, thanks for sharing the example! This request is relatively low priority on our backlog, but we are starting to work on #2440, which may be your preferred approach anyway. :)