New issue
Advanced search Search tips

Issue 614716 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

getUserMedia failures when a deviceId is used

Reported by bo...@sip-communicator.org, May 25 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:46.0) Gecko/20100101 Firefox/46.0

Example URL:

Steps to reproduce the problem:
1. Open a new tab
2. Execute the following in the javascript console
navigator.webkitGetUserMedia({ audio: { deviceId: "default" } }, function(stream) { console.log(stream); }, function(err) { console.log(err); })

What is the expected behavior?
The success callback of getUserMedia should be executed, with a valid MediaStream.

What went wrong?
The following error is printed, and neither the success nor error callbacks of getUserMedia being executed:
VM80:1 Uncaught TypeError: Failed to execute 'webkitGetUserMedia' on 'Navigator': cannot convert to dictionary.(…)

Did this work before? Yes I suspect that it worked about a week ago, although I haven't run the exact test

Is it a problem with Flash or HTML5? N/A

Does this work in other browsers? N/A 

Chrome version: https://beta.meet.jit.si/EasyCowsArgueAnxiously3  Channel: canary
OS Version: OS X 10.10
Flash Version: Adobe Flash Player - Version: 22.0.0.158

Doing the same Chrome stable and in other Canary instances that we've tried results in no error as expected.

The same error occurs if we replace "default" with the ID of any of the devices obtained from mediaDevices.enumerateDevices(). If we remove the "deviceId" constraint, there is no error.
 
Screen Shot 2016-05-24 at 11.17.11.png
544 KB View Download
The correct version is: Version 53.0.2748.0 canary (64-bit)

Comment 2 by rsesek@chromium.org, May 25 2016

Components: Blink>GetUserMedia
Labels: Needs-Feedback
boris@, can you retry your steps with today's canary (53.0.2749.2)? I'm unable to reproduce the error when I follow steps 1. and 2. in your original report.
I cannot reproduce it on 53.0.2749.2. However, I am running into another issue with deviceId, this time when combined with constraints.

This following works (pops up the user consent window):
constraints = {audio: { deviceId: "default" }};
navigator.webkitGetUserMedia(constraints, function(s){console.log('success', s);}, function(e){console.log('error', e);})

Changing the constraints to:
constraints = {audio: { mandatory: {}, deviceId: "default" }};
or
constraints = {audio: { optional: [], deviceId: "default" }};
results in the following error:
"Mailformed constraint: Cannot use both optional/mandatory and specific or advanced constraints."

This syntax works in stable, and I think it used to work in Canary until recently. Is this intentional?
Cc: jansson@chromium.org
Labels: -Needs-Feedback
Owner: hta@chromium.org
Status: Assigned (was: Unconfirmed)
hta@ - can you answer the question in #4? 
Also note we have a shim that converts old style to new style among other things.
https://github.com/webrtc/adapter

Comment 8 by hta@chromium.org, May 27 2016

Status: Fixed (was: Assigned)
I take it you're running with the experimental flag on? This feature is hidden behind a flag.

Re audio: { deviceId: "default" }:

This is a "naked value constraint". Support for parsing those values landed in Chrome tip-of-tree yesterday: https://codereview.chromium.org/1977513004/

Re constraints = {audio: { mandatory: {}, deviceId: "default" }}:

This mixes old-style constraints (mandatory/optional, 2013 version of the spec) with direct values (2014 and later versions of the W3C spec). What to do in this case isn't defined in either version of the spec, so we forbid it.

See https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/modules/mediastream/MediaTrackConstraintSet.idl&q=mandatory%20file:idl&sq=package:chromium&type=cs&l=25 for the precise IDL declaration.

I expect that your example is descended from code that was intended to work on both Firefox (which supports the new-style constraints) and Chrome (which supported only the old-style constraints), and that half your constraints were ignored on each platform.

Sticking to the standard style and using adapter.js is probably a better solution.

I'm marking this "fixed" since support for parsing this has landed (yesterday!); I suppose I could also choose "wontfix" for the examples in comment #4, but that's not where this bug started.
That explain it. Thank you!

Sign in to add a comment