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

API to request audio output device selection #86

Merged
merged 4 commits into from
Jul 2, 2020

Conversation

youennf
Copy link
Contributor

@youennf youennf commented Nov 6, 2019

PR for #83

Copy link
Member

@jan-ivar jan-ivar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this direction! Mostly nits and questions.

My main question is how to map temporary permissions?

Firefox has avoided session-based permissions thus far, doing one-offs or persistent permission only. But this API inherently needs a different kind of temporary permission I think, one that probably expires at the end of the page? Is that what Safari does?

index.html Outdated Show resolved Hide resolved
index.html Show resolved Hide resolved
index.html Outdated
has the value <code>NotAllowedError</code> and abort these steps.</p></li>
<li><p>Let <var>deviceInfo</var> be a new <code>MediaDeviceInfo</code> object to represent the selected audio output device.</p></li>
<li><p>Update <var>deviceInfo</var> as done by the
<code>enumeratedevices</code> algorithm steps 2.5.4 and 2.5.5.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step numbers may change. I think in mediacapture-main we should break out steps 2.5.3-2.5.5 into a new create a MediaDeviceInfo algorithm, and call that here. That way, all the storage stuff around deviceId and groupId can live there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I did this draft as a first step before modifying other specs. There is also the need to add a bunch of references for promises/permission

index.html Outdated Show resolved Hide resolved
index.html Show resolved Hide resolved
@jan-ivar
Copy link
Member

In my mind, Firefox would add ☑ Remember this decision to this prompt (on by default).

When the box is unchecked, return a deviceId which is good immediately only (timeout? eos?)
When the box is checked, return a persistent deviceId.

But is non-persistent permission important for speakers? There's no snooping risk.

Having the option to persist these things seems necessary to enable future multi-speaker use cases.

It also seems odd if a site can remember I use my bluetooth headset as a mic, but not as a speaker.

Which brings me to...

Does this API needs to accept constraints? Specifically, the deviceId or groupId constraint, to locate different features of a user's preferred physical device? This could then either limit choices in the prompt (exact) or at least influence the default choice (ideal) (like Firefox's cam/mic prompts today).

Otherwise, a site cannot remember the user's choice from last time without permission.
Said differently: revoking or not granting persistent permission would forget the user's preference.

So far, we've been able to distinguish memory from permission.

@youennf
Copy link
Contributor Author

youennf commented Jun 18, 2020

I think we should discuss the persistency in a follow-up discussion.
We may be able to provide some persistency similarly to what I described at the last interim for setSinkId:

  • We add an optional sinkId parameter to the requestAudioOutputDevice method.
  • If it is present and the ID does not refer to anything, prompt the user
  • Otherwise, we could prompt the user with preselected entry or we could resolve without even prompting the user (this device then shows up in enumerateDevices and can be used by setSinkId)

@youennf youennf force-pushed the request-audio-output branch from a84c327 to 69daca4 Compare June 18, 2020 11:37
index.html Outdated Show resolved Hide resolved
@jan-ivar
Copy link
Member

At end of call, I think we decided editors can integrate once follow-up issue has been filed for adding hooks.

@youennf
Copy link
Contributor Author

youennf commented Jul 2, 2020

Filed w3c/mediacapture-main#703

@jan-ivar jan-ivar merged commit e3f5e99 into w3c:master Jul 2, 2020
@bradisbell
Copy link

This change seems to propose disallowing a web application from getting an output device list and presenting it to the user, in favor of a browser-specific UI for doing this. Is this correct?

Such a change would break a lot of use cases. The browser doesn't know the context of what the application is trying to do. For example, it's common in my applications to use multiple audio outputs simultaneously. As part of saved config, I know what devices should be used for what, and when, because the user previously configured them in my application. If instead on every page load I have to request the user multiple times to select a device, this would be very damaging to the user experience.

@youennf
Copy link
Contributor Author

youennf commented Aug 3, 2020

This change seems to propose disallowing a web application from getting an output device list and presenting it to the user, in favor of a browser-specific UI for doing this. Is this correct?

This is correct.

As part of saved config, I know what devices should be used for what, and when, because the user previously configured them in my application.

This is a scenario that makes sense and we plan to work on that, with the same constraint as getUserMedia: we should not allow passive monitoring of output devices by a web page.

@youennf
Copy link
Contributor Author

youennf commented Aug 3, 2020

@bradisbell I filed #99

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

Successfully merging this pull request may close these issues.

Selecting audio output in case device info permission is not granted
5 participants