getUserrMedia constraints: deviceid or sourceId

1,596 views
Skip to first unread message

Rajmohan Banavi

unread,
Jan 21, 2016, 9:41:38 AM1/21/16
to discuss...@googlegroups.com
  • When I call getUserMedia() with audio constraints having a particular device ID, I see the following on the console
spec:   {"audio":{"deviceId":{"exact":"52587aa889e864a4f1647398992b2f35bcd424707c76d9c10eb995819d27bfb1"}},"video":false}
chrome: {"audio":{"mandatory":{"sourceId":"52587aa889e864a4f1647398992b2f35bcd424707c76d9c10eb995819d27bfb1"}},"video":false}
chrome: {"audio":{"mandatory":{"sourceId":"52587aa889e864a4f1647398992b2f35bcd424707c76d9c10eb995819d27bfb1"}},"video":false}
Got stream with constraints: Object {audio: Object, video: false}audio: Objectmandatory: ObjectsourceId: "52587aa889e864a4f1647398992b2f35bcd424707c76d9c10eb995819d27bfb1"__proto__: Object__proto__: Objectvideo: false__proto__: Object
Audio Device: Microphone Array (IDT High Definition Audio CODEC)
Using audio device: Microphone Array (IDT High Definition Audio CODEC)

What are these (spec/chrome/chrome) on the console? Should I be using deviceId or sourceId in the constraints?


  • On another note, if I add a "mandatory" constraint for device Id, then I see an error - "TrackStartError". Why so?

spec:   {"audio":{"mandatory":{"deviceId":{"exact":"41d79ad22d3564ca5be1324ec1f6273d6c35d2382994924b084e1dfe790bcc14"}}},"video":false}
chrome: {"audio":{"mandatory":{"deviceId":{"exact":"41d79ad22d3564ca5be1324ec1f6273d6c35d2382994924b084e1dfe790bcc14"}}},"video":false}
chrome: {"audio":{"mandatory":{"deviceId":{"exact":"41d79ad22d3564ca5be1324ec1f6273d6c35d2382994924b084e1dfe790bcc14"}}},"video":false}
Error while accessing microphone and/or camera: TrackStartError NavigatorUserMediaError {}



Christoffer Jansson

unread,
Jan 22, 2016, 7:28:41 AM1/22/16
to discuss...@googlegroups.com
Hi,

What you see is the result of using the adapter.js shim, old style = sourceId and new style = deviceId. Chrome still does not support new style constraints and adapter.js translates them into the old style.

In other words, as long as you use adapter.js, feel free to use the latest spec deviceId.

/Chris



--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/CAJWm%2BfFFkMaWHimS%2B6VBjgWMWUW1ccBJS-Cq8VJ47dNDX_XHZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Rajmohan Banavi

unread,
Jan 22, 2016, 9:52:37 AM1/22/16
to discuss...@googlegroups.com
Thanks Chris. How about the 2nd part? Why does gUM() throw an error "TrackStartError" if I add "mandatory" to the constraints "deviceId"? 

spec:   {"audio":{"mandatory":{"deviceId":{"exact":"41d79ad22d3564ca5be1324ec1f6273d6c35d2382994924b084e1dfe790bcc14"}}},"video":false}
chrome: {"audio":{"mandatory":{"deviceId":{"exact":"41d79ad22d3564ca5be1324ec1f6273d6c35d2382994924b084e1dfe790bcc14"}}},"video":false}
chrome: {"audio":{"mandatory":{"deviceId":{"exact":"41d79ad22d3564ca5be1324ec1f6273d6c35d2382994924b084e1dfe790bcc14"}}},"video":false}
Error while accessing microphone and/or camera: TrackStartError NavigatorUserMediaError {}

Cheers,
Rajmohan


Christoffer Jansson

unread,
Jan 25, 2016, 6:03:08 AM1/25/16
to discuss...@googlegroups.com
Without having tested it, it might be an adapter.js issue where it expects the deviceId/sourceId to be part of optional constraints. What if you try the same without adapter.js (you might have to use sourceId as I cannot remember if it's implemented in chrome yet and we just shim it in adapter.js)?

Reply all
Reply to author
Forward
0 new messages