Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
153
rated 0 times [  160] [ 7]  / answers: 1 / hits: 47055  / 9 Years ago, wed, march 11, 2015, 12:00:00

I'm playing with browser and audio.



I'm doing this



        var session = {
audio: true,
video: false
};
var recordRTC = null;
navigator.getUserMedia(session, initializeRecorder, onError);


But, using latest FF available I got a javascript error, saying that




navigator.getUserMedia is not a function




I copied this code from this blog post: https://blog.groupbuddies.com/posts/39-tutorial-html-audio-capture-streaming-to-nodejs-no-browser-extensions



And similar on latest Chrome:




Uncaught TypeError: undefined is not a function




But I know that this api is supported from both browser



What am I doing wrong?


More From » firefox

 Answers
11

Navigator.getUserMedia() is deprecated, advised to use MediaDevices.getUserMedia()



async function getMedia(pc) {
let stream = null;

try {
stream = await navigator.mediaDevices.getUserMedia(constraints);
/* use the stream */
} catch(err) {
/* handle the error */
}
}

[#67478] Tuesday, March 10, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
robinh

Total Points: 371
Total Questions: 105
Total Answers: 89

Location: Cyprus
Member since Mon, Oct 24, 2022
2 Years ago
;