Questions tagged [mediadevices]

107 questions
14
votes
5 answers

getUserMedia - how to detect if the device actually has a camera

I'm playing with the html5/javascript getUserMedia api to write a js app that will use the device's camera if available. I'm using Modernizr to detect the capability (of the browser) like this: if (Modernizr.getusermedia) { And within the true…
Nathan Russell
  • 2,938
  • 4
  • 28
  • 47
11
votes
2 answers

What camera communication standards are used by Navigator.MediaDevices.getUserMedia()?

Does anyone know what communication standards are being used to detect camera hardware for use with getUserMedia? I presume that it's MTP or something like that, although I expect that the implementation is different for each browser/OS, but I've…
Nanhydrin
  • 4,022
  • 2
  • 37
  • 49
10
votes
1 answer

Check if browser/platform support screen capturing via `getDisplayMedia`

We can request a media stream to a screen or windows via navigator.mediaDevices.getDisplayMedia(). However, this immediately prompts the user to decide which kind of capturing to use. I need to check if the browser/platform even support screen…
Lukas Kalbertodt
  • 55,166
  • 13
  • 173
  • 236
5
votes
1 answer

How to check if the permission to access microphone has been rejected by the user in FireFox

Is there a way to find out if the user has rejected or allowed permission to the media devices (Eg: Microphone, Camera) in Firefox?. In Chrome, I can check that with navigator.permissions.query but this fails in Firefox with a…
Murali Nepalli
  • 1,458
  • 4
  • 16
5
votes
2 answers

How to get a media stream of the speaker's output to transfer it over the network or record it?

I'm trying to get the output of the speaker and then do what ever I want with this stream . I tried to use this to get the speaker's stream: var mySpeakerStream = new MediaStream(); navigator.mediaDevices.getUserMedia({audio: {deviceId : {exact:…
4
votes
3 answers

Javascript DOMException: The associated Track is in an invalid state

I'm trying to create a photo capture web app on a nodeJS server, and i'm using the javascript code below. const btn = document.querySelector('#btn'); btn.addEventListener('click', (event) => { navigator.mediaDevices.getUserMedia({video: true}) …
we_mor
  • 329
  • 2
  • 12
4
votes
1 answer

Asking for camera permission without turning the camera on

Whenever I accept the permission to use the camera on the browser, my desktop camera will light up. I would assume this is because navigator.mediaDevices.getUserMedia() returns a stream on success, and that stream is straight from the camera. I do…
Artish1
  • 61
  • 9
3
votes
0 answers

mediaSession does not work with streaming

I have mediaSession working great when it comes to simple video files. You can use your media keys pause and play. let video = useRef(null) useEffect(() => { video.current.play() .then(_ => { navigator.mediaSession.metadata = new…
PepperAddict
  • 474
  • 2
  • 6
  • 13
3
votes
1 answer

navigator.mediaDevices.enumerateDevices does not return any audioinput devices on iOS Safari (13.2.3)

I am trying to record audio on iOS Safari (13.2.3), but Safari is not providing access to the microphone. When I call navigator.mediaDevices.enumerateDevices, it only returns a single MediaDeviceInfo (kind: videoinput) I read elsewhere to call…
Chris
  • 345
  • 2
  • 12
3
votes
0 answers

Typescript find MediaDeviceInfo of rear camera

I am using the ZXingScannerComponent with Angular. With this component you have to set the desired camera based on it's MediaDeviceInfo. My current code looks something like that: navigator.mediaDevices.enumerateDevices() .then(function(devices) { …
perotom
  • 819
  • 11
  • 30
3
votes
1 answer

navigator.mediaDevices.getUserMedia Error "DOMException"

Microphone permission granted. I get the error "DOMException" without any detailed description when I try to run this code await navigator.mediaDevices.getUserMedia({audio: true}). Even in console< when I run this code…
Ilya Degtyarenko
  • 782
  • 6
  • 13
3
votes
1 answer

Javascript navigator.mediaDevices.getUserMedia moves source to front

I'm using this code but when it gets the source it always moves that window to the front which is kind of annoying, but I don't see any options in this code that make it move to the front so not sure how to prevent it. It moves the source to the…
Hasen
  • 7,909
  • 17
  • 53
  • 106
3
votes
1 answer

Trying to capture audio but navigator.mediaDevices.enumerateDevices() is NULL on Safari 12 even with microphone permissions granted

See related question: Navigator.mediaDevices.getUserMedia not working on iOS 12 Safari We are trying to capture audio from user input user MediaDevices.getUserMedia and Audio Context When the user clicks a button we check for available devices and…
islalobo
  • 507
  • 6
  • 17
2
votes
1 answer

Xamarin Android Webview Camera Permission granted but no access

I have created a webview app, where I scan QR Code. Everything works fine on mobile and desktop browser, but in the app I get Unable to access video stream (please make sure you have a webcam enabled). I am sharing some of the Code below : Here is…
2
votes
0 answers

Chrome - enable 'share audio' by default with navigator.mediaDevices.getDisplayMedia

I want to capture tab audio with Chrome. I call navigator.mediaDevices .getDisplayMedia({ video: true, audio: true, }) .then(stream => {...}) but the 'share audio' option is not ticked by default on the Chrome…
1
2 3 4 5 6 7 8