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.
,
May 25 2016
,
May 26 2016
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.
,
May 26 2016
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?
,
May 27 2016
hta@ - can you answer the question in #4?
,
May 27 2016
mandatory/optional has been removed in favour of the new style syntax as the error message you see hints at. Some examples can found in our samples: - https://github.com/webrtc/samples/blob/gh-pages/src/content/devices/input-output/js/main.js#L99 - https://github.com/webrtc/samples/blob/gh-pages/src/content/peerconnection/constraints/js/main.js#L98 - https://github.com/webrtc/samples/blob/gh-pages/src/content/getusermedia/resolution/js/main.js#L37
,
May 27 2016
Also note we have a shim that converts old style to new style among other things. https://github.com/webrtc/adapter
,
May 27 2016
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.
,
May 27 2016
That explain it. Thank you! |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by bo...@sip-communicator.org
, May 25 2016