0
votes

I'm trying to use getUserMedia to connect user's mic to internal nodes. I've tried the Google example at https://webrtc.github.io/samples/src/content/getusermedia/audio/ and it works just fine in Chrome. I've then downloaded the source and tried that on my own website. Now it doesn't work! The page renders but the audio doesn't play. The URL is http://www.rwilson.org.uk/webrtc/src/content/getusermedia/audio/

The console message is "Uncaught TypeError: Cannot read property 'getUserMedia' of undefined at main.js:36" That line is:

navigator.mediaDevices.getUserMedia(constraints).then(handleSuccess).catch(handleError);

How can I find out what's going on? Does that point to a problem with my website (security perhaps)?

New info: I have now run the Google example code from my localhost (running on my Chromebook with Web Server for Chrome), and it works. So the problem must be with my own (hosted) server. Not sure how to do that!

1

1 Answers

0
votes

If the current document isn't loaded securely, navigator.mediaDevices will be undefined, and you cannot use getUserMedia().

Source MediaDevices.getUserMedia()