Questions tagged [getusermedia]

Access to media data streams--webcam video, microphone audio--from browser Javascript. Abbreviated gUM

getUserMedia provides access to data streams from media devices such as webcams and microphones. It is used from Javascript running in a user's web browser. It supports the development of front-end web application code for capturing media.

Support varies from browser to browser and device to device. See CanIUse.com for up-to-date information.

getUserMedia forms part of browser-resident WebRTC support (see ). It can be used by itself without establishing WebRTC connections.

getUserMedia is often abbreviated gUM. It's often used in conjunction with MediaRecorder; see .

Further references:

See also:

964 questions
174
votes
16 answers

Stop/Close webcam stream which is opened by navigator.mediaDevices.getUserMedia

I opened a webcam by using the following JavaScript code: const stream = await navigator.mediaDevices.getUserMedia({ /* ... */ }); Is there any JavaScript code to stop or close the webcam? Thanks everyone.
Shih-En Chou
  • 3,161
  • 6
  • 17
  • 25
88
votes
5 answers

reprompt for permissions with getUserMedia() after initial denial

How do we go about requesting camera/microphone access with getUserMedia() after being denied once? I'm working with getUserMedia to access the user's camera and pipe the data to a canvas. That bit all works fine. In testing, I hit deny once. At…
Geuis
  • 37,442
  • 53
  • 145
  • 213
51
votes
2 answers

Sending a MediaStream to host Server with WebRTC after it is captured by getUserMedia

I am capturing audio data using getUserMedia() and I want to send it to my server so I can save it as a Blob in a MySQL field. This is all I am trying to do. I have made several attempts to do this using WebRTC, but I don't even know at this point…
Jimmery
  • 8,925
  • 23
  • 75
  • 142
35
votes
2 answers

Turn off webcam/camera after using getUserMedia

I'm developing a Chrome Extension that uses the background page to access the user's webcam. Users are given the option to turn the camera off. The stream appears to be being turned off. The relevant functions are no longer receiving the stream.…
Niazipan
  • 805
  • 1
  • 8
  • 15
34
votes
5 answers

Converting WAV to any compressed audio format in client-side JavaScript

I am recording audio from getUserMedia({audio:true}); in the browser using Recorder.js and then exporting it as a WAV file because that's the only option the library provides. A 1 minute 20 seconds file is 14.1 MB large. I need to upload the audio…
Arjun Bajaj
  • 1,822
  • 7
  • 23
  • 40
31
votes
5 answers

HTML5 getUserMedia record webcam, both audio and video

Is it possible to use Chrome to capture video (webcam) and audio (microphone) from the browser and then save the stream as video file? I would like to use this to create a video/photobooth-like application that allows users to record a simple (30…
Harm Kabisa
  • 331
  • 2
  • 4
  • 6
30
votes
2 answers

getUserMedia() in chrome 47 without using https

In chrome version 47 they force you to use https to be allow using getUserMedia(). Unfortunately, I can't use https in my whole web, I only use it in the login rest (It a SPA - single page app). So, the address to the web is without https, only the…
Noampz
  • 1,105
  • 3
  • 11
  • 18
28
votes
9 answers

NotReadableError: Failed to allocate videosource

I get this error in Firefox 51 when I try to execute the following code and when I select my laptop's camera: navigator.getMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mediaDevices.getUserMedia || …
28
votes
2 answers

Is it possible to control the camera light on a phone via a website?

Is it possible to control the camera light on a phone via a website? Say through Chrome or Firefox. I know it's possible using an Android or iOS app, which the many flashlight apps out there. And I know one can control the cameras via the…
TinyTheBrontosaurus
  • 2,652
  • 5
  • 17
  • 32
28
votes
7 answers

Change sample rate of AudioContext (getUserMedia)

Im trying to record a 48000Hz recording via getUserMedia. But without luck. The returned audio MediaStream returns 44100Hz. How can i set this to 48000Hz? Here are snippets of my code: var startUsermedia = this.startUsermedia; …
f.lorenzo
  • 886
  • 2
  • 9
  • 22
26
votes
1 answer

streaming getUserMedia to server

I'm new to binary data and getUserMedia, what would be the recommended way to stream getUserMedia (video/audio) to a server and then prepare the stream (video/audio) for other connections? My initial thought was to send the data over websockets and…
8eecf0d2
  • 1,451
  • 1
  • 11
  • 22
25
votes
3 answers

Navigator.mediaDevices.getUserMedia not working on iOS 12 Safari

As of iOS 12, navigator.mediaDevices.getUserMedia() is returning an error in Safari. To recreate this, open iPhone Web Inspector, then run this snippet in the console: var constraints = { audio: true, video: { width: 1280, height: 720 } };…
Severisth
  • 371
  • 1
  • 3
  • 4
24
votes
3 answers

In android's Google Chrome, how to set unsafely-treat-insecure-origin-as-secure

I'm using getUserMedia() in my web app which works fine when I test my app on localhost. But if I treat my laptop as server and launch app in Google Chrome browser of my android phone, it gives me the error: getUserMedia() no longer works on…
Developer
  • 605
  • 1
  • 7
  • 16
23
votes
2 answers

getUserMedia lock focus/exposure

I am using navigator.getUserMedia with constraints to access the user's webcam, using the feed as the source of an HTML
Jody Heavener
  • 2,306
  • 5
  • 33
  • 64
21
votes
3 answers

HTML5 capture and save video

I am building a site for sing-alongs where the user can capture a video of themselves singing along with an mp3. I have gotten to the point that I can access the camera and display the live stream, but how can i save the video so the user can…
scalen121
  • 835
  • 3
  • 9
  • 20
1
2 3
64 65