Closed Bug 802326 Opened 12 years ago Closed 8 years ago

If video and audio is requested in gUM, but one of them fails, we should align with the spec

Categories

(Core :: WebRTC, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jsmith, Assigned: jib)

References

(Depends on 1 open bug, )

Details

(Keywords: dev-doc-complete)

Attachments

(7 files)

58 bytes, text/x-review-board-request
jesup
: review+
Details
58 bytes, text/x-review-board-request
jesup
: review+
Details
58 bytes, text/x-review-board-request
jesup
: review+
Details
58 bytes, text/x-review-board-request
jesup
: review+
Details
58 bytes, text/x-review-board-request
florian
: review+
Details
58 bytes, text/x-review-board-request
florian
: review+
Details
58 bytes, text/x-review-board-request
sebastian
: review+
Details
Steps:

1. Execute a gUM call for video and audio in which audio fails, video successful

Expected:

We should either do the following (the final decision here is probably dependent on the spec):

1. Not fire any permissions prompt at all and reports NO_DEVICES_FOUND
2. Fire the permissions prompt for video and only give access to the camera in the MediaStream

Actual:

We're a bit inconsistent right now. We fire up a permissions prompt for requesting access to the camera, but then we report NO_DEVICES_FOUND. We should probably do either one of the behaviors stated above, subject to what the spec editors decide on is the right behavior.
Summary: If video and audio is requested in gUM, but audio portion fails, video is successful, we should still show → If video and audio is requested in gUM, but audio portion fails, video is successful, we should either show no permissions prompt and error out or give access to the video portion only
Whiteboard: [getUserMedia]
Also - I haven't tested the opposing use case (video fails, audio successful), but I'd imagine that whatever we decide here should fall in alignment with that use case as well.
Component: WebRTC: Audio/Video → WebRTC
Version: unspecified → Trunk
Whiteboard: [getUserMedia] → [getUserMedia] [blocking-gum+]
Summary: If video and audio is requested in gUM, but audio portion fails, video is successful, we should either show no permissions prompt and error out or give access to the video portion only → If video and audio is requested in gUM, but one of them fails, we should align with the spec
Do a parity chrome test to see what they do.
Keywords: qawanted
Whiteboard: [getUserMedia] [blocking-gum+] → [getUserMedia]
(In reply to Jason Smith [:jsmith] from comment #2)
> Do a parity chrome test to see what they do.

They do not error out, they instead only give access to one of the two input devices available.

Fun fact also - apparently they don't support the loading of audio resources into an audio tag from gUM.
Keywords: qawanted
Whiteboard: [getUserMedia] → [getUserMedia] [blocking-gum-]
Let's retest this and see where we are (including parity test against Chrome)
Flags: needinfo?(jsmith)
Keywords: qawanted
On Firefox - requesting gUM video/audio where audio fails results in a video gUM perm prompt appearing that a user can grant access to their video only. The video plays from the camera with the visible indicator indicating your camera is active. This is differing behavior than what was seen on filing of this bug.

On Chrome - requesting gUM video/audio where audio fails results in a video/audio gUM prompt appearing that a user can grant access to their video/audio. The video plays from the camera with the visible indicator indicating your camera/mic is active. To me, this feels like a bug in Chrome, as it's indicating a microphone is active that can't possibly be requested to be used.

Firefox's behavior sounds acceptable now in terms of what I think makes sense, but the differing behavior between browsers I think reveals that there needs to be clarification made clearly in the spec on what the right behavior is.
Flags: needinfo?(jsmith)
Keywords: qawanted
Are we aligned with the spec on this now?  If so, we can close it.
backlog: --- → webRTC+
Rank: 35
Flags: needinfo?(jib)
Priority: -- → P3
QA Contact: jsmith
Whiteboard: [getUserMedia] [blocking-gum-]
We're not aligned yet.

The spec (URL) says: "The provided media MUST include precisely one track of each media type in requestedMediaTypes from the finalSet."

There are two places we violate this, e.g. for audio:

1. There is no mic on this system (so we ask the user for camera only).
2. We ask the user for camera+mic and the user chooses camera but "No audio".

Vice versa for video. Both 1 and 2 violate the spec, but this bug AFAICT is only 1.

For 1, I think we said we would flip the behavior once we have enumerateDevices(), the rationale being that apps that want to accommodate users with a camera but no microphone, and/or users with a microphone but no camera on their system, now can explicitly check for said people.

We can flip that behavior now.

For 2, I believe the doorhangers need to stop offering "No video" and "No audio" as choices when video + audio is requested (they already do the right thing when only one kind is requested). Do we want/have a separate bug for that?
Assignee: nobody → jib
Flags: needinfo?(jib)
Rank: 35 → 21
Priority: P3 → P2
STR:

On Windows on a machine with a camera which supports only up to 720p do this:
- open https://webrtc.github.io/samples/src/content/peerconnection/constraints/
- move the sliders for min an max width and height all the to the right to request 1080p resolution
- click the "Get Media" button

Actual result:
- Only a prompt for sharing the mic pops up and the page only gets an audio stream

Expected result:
- Because of the constraints we should return an error to make clear that the resolution constraints were not met
I increased the priority because of comment 9. This use-case is worse than cases I've previously considered, since the site is using required constraints.

Required constraints were designed to allow sites to try to request using their strictest requirements first, and be able to rely on this failing, so the site can fall back to different constraints.

This bug has the unintended consequence of giving the site no camera at all, if audio was also requested, even though the user has a camera, which is quite bad.
Comment on attachment 8749921 [details]
MozReview Request: Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on desktop.

https://reviewboard.mozilla.org/r/51011/#review48407

::: browser/modules/webrtcUI.jsm
(Diff revision 1)
> -      if (requestTypes.length == 2) {
> -        let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
> -        if (!sharingScreen)
> -          addDeviceToList(camMenupopup, stringBundle.getString("getUserMedia.noVideo.label"), "-1");
> -        if (!sharingAudio)
> -          addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1");

If you are removing these strings, you also want to remove them from the browser.properties file.

What about the case where the website requests both audio and screen/app/tab/window sharing, and the user selects "No Window"?
Attachment #8749921 - Flags: review?(florian)
Comment on attachment 8749922 [details]
MozReview Request: Bug 802326 - update tests to work wo/"No Video" and "No Audio" in cam+mic permission prompt.

https://reviewboard.mozilla.org/r/51247/#review48409

::: browser/base/content/test/general/browser_devices_get_user_media.js:16
(Diff revision 1)
>                   this);
>  
>  function enableDevice(aType, aEnabled) {
>    let menulist = document.getElementById("webRTC-select" + aType + "-menulist");
>    let menupopup = document.getElementById("webRTC-select" + aType + "-menupopup");
>    menulist.value = aEnabled ? menupopup.firstChild.getAttribute("value") : "-1";

I don't see how setting this to -1 can work anymore if we remove the "No Audio" / "No Video" item from the menulist.

::: browser/base/content/test/general/browser_devices_get_user_media.js:292
(Diff revision 1)
>      yield checkPerm(true, false, true, undefined, true, undefined);
>      info("video only, user grants, check video perm set to allow, audio perm not set");
>      yield checkPerm(false, true, undefined, true, undefined, true);
>  
>      // 3 cases where the user rejects the device request.
>      // First test these cases by setting the device to 'No Audio'/'No Video'

Did you mean to rephrase this comment? What's the meaning of "No Audio"/"No Video" now?
Attachment #8749922 - Flags: review?(florian)
(In reply to Florian Quèze [:florian] [:flo] from comment #18)
> If you are removing these strings, you also want to remove them from the
> browser.properties file.

Thanks, I'll address those.

> What about the case where the website requests both audio and
> screen/app/tab/window sharing, and the user selects "No Window"?

Is there a test I missed?

I've verified manually that previously you would have gotten audio only, whereas with these patches you get SecurityError.

On a side-note: I see there's no UX for { video: true, audio: { mediaSource: "audioCapture" } }.
Flags: needinfo?(florian)
(In reply to Jan-Ivar Bruaroey [:jib] from comment #20)
> whereas with these patches you get SecurityError.

which I believe is correct.
Comment on attachment 8749917 [details]
MozReview Request: Bug 802326 - make getUserMedia fail if required video constraints aren't met, regardless of audio.

https://reviewboard.mozilla.org/r/51003/#review48499
Attachment #8749917 - Flags: review?(rjesup) → review+
Comment on attachment 8749918 [details]
MozReview Request: Bug 802326 - test that getUserMedia fails w/required video constraint, regardless of audio.

https://reviewboard.mozilla.org/r/51005/#review48501
Attachment #8749918 - Flags: review?(rjesup) → review+
Attachment #8749919 - Flags: review?(rjesup) → review+
Comment on attachment 8749919 [details]
MozReview Request: Bug 802326 - make getUserMedia fail audio+video request unless user has both.

https://reviewboard.mozilla.org/r/51007/#review48503
Comment on attachment 8749920 [details]
MozReview Request: Bug 802326 - make getUserMedia fail audio+video request unless user shares both.

https://reviewboard.mozilla.org/r/51009/#review48505
Attachment #8749920 - Flags: review?(rjesup) → review+
https://reviewboard.mozilla.org/r/51011/#review48407

> If you are removing these strings, you also want to remove them from the browser.properties file.
> 
> What about the case where the website requests both audio and screen/app/tab/window sharing, and the user selects "No Window"?

Replied in comment 20 (forgot to comment through mozReview).
Comment on attachment 8749921 [details]
MozReview Request: Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on desktop.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/51011/diff/1-2/
Attachment #8749921 - Flags: review?(florian)
Attachment #8749922 - Flags: review?(florian)
Attachment #8749923 - Flags: review?(s.kaspari)
Comment on attachment 8749922 [details]
MozReview Request: Bug 802326 - update tests to work wo/"No Video" and "No Audio" in cam+mic permission prompt.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/51247/diff/1-2/
Comment on attachment 8749923 [details]
MozReview Request: Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on android.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/51013/diff/1-2/
Flags: needinfo?(florian)
(In reply to Jan-Ivar Bruaroey [:jib] from comment #20)
> (In reply to Florian Quèze [:florian] [:flo] from comment #18)
> > If you are removing these strings, you also want to remove them from the
> > browser.properties file.
> 
> Thanks, I'll address those.
> 
> > What about the case where the website requests both audio and
> > screen/app/tab/window sharing, and the user selects "No Window"?
> 
> Is there a test I missed?
> 
> I've verified manually that previously you would have gotten audio only,
> whereas with these patches you get SecurityError.

I meant this code:
http://mxr.mozilla.org/mozilla-central/source/browser/modules/webrtcUI.jsm?rev=8c55d8beba75#462
462         // "No <type>" is the default because we can't pick a
463         // 'default' window to share.
464         addDeviceToList(menupopup,
465                         stringBundle.getString("getUserMedia.no" + typeName + ".label"),
466                         "-1");

It seems inconsistent to keep "No Window" in the UI when we don't have "No Video" anymore. But as the comment there says, we can't pick a default window to share.

I guess a less inconsistent UI would be to replace the "No Window" item with a disabled "(select window)" item, and to disable the "Share Selected Items" button until something is selected. This requires significantly more code changes though.
Comment on attachment 8749922 [details]
MozReview Request: Bug 802326 - update tests to work wo/"No Video" and "No Audio" in cam+mic permission prompt.

https://reviewboard.mozilla.org/r/51247/#review48723

The test changes look good, in that they match what's implemented in the webrtcUI.jsm patch.

::: browser/base/content/test/general/browser_devices_get_user_media.js:274
(Diff revision 2)
>      info("audio only, user grants, check audio perm set to allow, video perm not set");
> -    yield checkPerm(true, false, true, undefined, true, undefined);
> +    yield checkPerm(true, false, true, undefined);
>      info("video only, user grants, check video perm set to allow, audio perm not set");
> -    yield checkPerm(false, true, undefined, true, undefined, true);
> +    yield checkPerm(false, true, undefined, true);
>  
>      // 3 cases where the user rejects the device request.

I would like this comment to keep the "by using the 'Never Share' action." mention, to explain the additional true parameter in these calls.
Attachment #8749922 - Flags: review?(florian) → review+
Attachment #8749921 - Flags: review?(florian) → review+
Comment on attachment 8749921 [details]
MozReview Request: Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on desktop.

https://reviewboard.mozilla.org/r/51011/#review48841

Thinking about what I wrote in comment 30 again, I still think the situation with the "No Window" item where the user can click "Share Selected Items" and we end up returning a security error to the website is a bug, but it already exists when only the screen/window/app share is requested without audio, so that's probably not something to worry about here, we can open a follow-up.
Comment on attachment 8749922 [details]
MozReview Request: Bug 802326 - update tests to work wo/"No Video" and "No Audio" in cam+mic permission prompt.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/51247/diff/2-3/
Comment on attachment 8749923 [details]
MozReview Request: Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on android.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/51013/diff/2-3/
(In reply to Florian Quèze [:florian] [:flo] from comment #30)
> I guess a less inconsistent UI would be to replace the "No Window" item with
> a disabled "(select window)" item, and to disable the "Share Selected Items"ree.
> button until something is selected.

Wfm. Do you want to file the follow-up?
(In reply to Jan-Ivar Bruaroey [:jib] from comment #35)
> (In reply to Florian Quèze [:florian] [:flo] from comment #30)
> > I guess a less inconsistent UI would be to replace the "No Window" item with
> > a disabled "(select window)" item, and to disable the "Share Selected Items"ree.
> > button until something is selected.
> 
> Wfm. Do you want to file the follow-up?

Filed bug 1272304.
Comment on attachment 8749923 [details]
MozReview Request: Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on android.

https://reviewboard.mozilla.org/r/51013/#review49385

LGTM.
Attachment #8749923 - Flags: review?(s.kaspari) → review+
I've added this information to Firefox 49 for developers. I didn't see any other documentation that needed updating for this; this is basically a UX change -- the behavior is just updated to match the spec.
Depends on: 1320615
Depends on: 1333186
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: