Skip to content
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

Add changes and required hooks for ALS and Media Capture integration #451

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rakuco
Copy link
Member

@rakuco rakuco commented Dec 13, 2022

Related to w3c/ambient-light#79. See w3c/ambient-light#83 for the ALS side.

The idea in that issue is to only provide illuminance readouts if there is at
least one active local video source together with ALS.

This is based on the assumptions that prompting users for ALS access is too
confusing (too few people would know what an ambient light sensor is) and that,
if illuminance readouts are provided only if a local video source is active, it
means getUserMedia() has been called, a user has granted the "camera"
permission and the user agent is showing that a camera is being used.

This pull request adds the required scaffolding to the main Generic Sensor
spec:

  • Export the "sensor task source" definition for the ALS spec to use.
  • Stop requiring the "sensor permission names" set to be non-empty, as ALS will
    rely on (but not request) the "camera" permission instead.
  • Add an optional "pre-activation checks algorithm" hook that extension
    specifications can implement and that is run as part of the "activate a
    sensor object" abstract operation.

Preview | Diff

Extension specifications may need to use to queue tasks in their own
operations.
…ents".

The new algorithms were defined in the "Sensor Type" section, but it makes
sense to list them when describing what extension specifications may do.
Related to w3c/ambient-light#79, where we want to replace the
"ambient-light" powerful feature with an integration with the Media Capture
and Streams spec by only providing illuminance readouts if the same page has
an active local video source.

Part of it requires checking the above condition when `Sensor.start()` is
called; the new algorithm introduced here does it in the "activate a sensor
object" abstract operation.

Additionally, `Sensor.start()` is now invoking "activate a sensor object" as
a queued task, as we want it to run in the main event loop rather than in
parallel since at least the Ambient Light Sensor implementation of the
"pre-activation checks algorithm" needs access to the relevant global object
and its internal slots.
Related to w3c/ambient-light#79, where we want to replace the
"ambient-light" powerful feature with an integration with the Media Capture
and Streams spec by only providing illuminance readouts if the same page has
an active local video source.

In this case, we rely on the Media Capture and Streams' permission model, as
having an active local video source implicitly means the "camera" permission
has already been granted.

Mention the Ambient Light Sensor case and change the requirement for the
snesor permissions name set.
See the discussion in w3c/ambient-light#83 -- "local video source" could end
up including screen capture sessions.
@rakuco rakuco changed the title Editorial: Add changes and required hooks for ALS and Media Capture integration Add changes and required hooks for ALS and Media Capture integration Jan 17, 2023
@rakuco rakuco marked this pull request as ready for review January 17, 2023 15:53
@anssiko
Copy link
Member

anssiko commented Jan 30, 2023

@rakuco would you prefer us to merge this now or coordinate the landing with w3c/ambient-light#83?

@rakuco
Copy link
Member Author

rakuco commented Jan 30, 2023

I think it makes sense to merge the two PRs together. I'm working on an explainer for these changes for wider circulation first and will ping you to merge both PRs once everything is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants