getUserMedia--DOMException: Requested device not found

10,026 views
Skip to first unread message

yez...@qq.com

unread,
Nov 5, 2018, 5:25:24 AM11/5/18
to discuss-webrtc
navigator.mediaDevices.getUserMedia({audio:true, video:true})
.then(function(stream) {
myVideoStream = stream;
// display my local video to me
myVideo.srcObject = stream;
})
.catch(function(err) {
console.log(err);
});
Hello everybody!My computer has no microphone,so I got an error from 'err'(DOMException: Requested device not found)
how can I handle this error if I only has a camera?

By the way,if I delete "audio:true",It works well.

PhistucK

unread,
Nov 5, 2018, 5:51:07 AM11/5/18
to WebRTC-discuss
Is this an OverconstrainedError? If not, maybe it should be (because only one of the constraints is not met)?

PhistucK


--

---
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/c59a82cb-9f76-402e-a2e4-34e70c8395ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohd Yusuf Siddiqui

unread,
Nov 5, 2018, 5:52:17 AM11/5/18
to discuss...@googlegroups.com
You can't keep Audio =true and have no audio hardware.If you still wish to set at runtime,check for audio hardware and set the flag as true/false accordingly.

Regards
Mohd Yusuf Siddiqui
Mob.
+91.9910339143
India

__________________________________________________________________________________________________________________________________________________________________

This communication & accompanying documents ("this e-mail") contains confidential and/or privileged information for exclusive    use of the individual to whom it is addressed. If you are not the intended recipient, please immediately notify the company & delete this e-mail. Any unauthorized use or disclosure of this e-mail is strictly prohibited. Representations in this e-mail are subject to contract. As an e-mail user please be cautious of the technical & other vulnerabilities of the internet which may result in malicious and/or unauthorized access to / use / alteration of e-mails/e-mail IDs. Thank you.

_______________________________________________________________________________________________________________________________________________________________



--

yez...@qq.com

unread,
Nov 5, 2018, 9:32:47 PM11/5/18
to discuss-webrtc
Yes,you are right.I find a way to resolve it:
    var enumeratorPromise = navigator.mediaDevices.enumerateDevices().then(function(devices) {
       
var cam = devices.find(function(device) {
         
return device.kind === "videoinput";
       
});
         
var mic = devices.find(function(device) {
           
return device.kind === "audioinput";
         
});
         
var constraints = {video:cam && mediaConstraints.video, audio:mic && mediaConstraints.audio};
          console
.log("getUserMedia start mediaConstraints=" + JSON.stringify(constraints));
         
return navigator.mediaDevices.getUserMedia(constraints)
                   
.then(function(stream) {
                      gotUserMedia
(stream);
                   
}).catch(function(err) {
                      console
.log(err.name);
                   
});
       
});

Thanks!

在 2018年11月5日星期一 UTC+8下午6:52:17,Yusuf Siddiqui写道:

yez...@qq.com

unread,
Nov 5, 2018, 9:45:06 PM11/5/18
to discuss-webrtc
I have no idea.It seems like an "OverconstrainedError", but  throws "NotFoundError",because no audio input devices are found.

在 2018年11月5日星期一 UTC+8下午6:51:07,PhistucK写道:
Reply all
Reply to author
Forward
0 new messages