mediadevices

Closing webcam without reloading

狂风中的少年 提交于 2021-02-08 11:46:15
问题 I'm a a beginner in web development and I’m working on a video chat app built with create-react-app . I’m using recordRTC library for record and stream from users’s webcam and microphone. When I stop recording, I also would like to close the webcam. import React, { Component } from "react"; import RecordRTC from "recordrtc"; const captureUserMedia = callback => { const params = { audio: true, video: true }; navigator.mediaDevices .getUserMedia(params) .then(callback) .catch((error) => {

MediaDevices.getUserMedia() How can I set audio constraints (sampling rate/bit depth)?

我们两清 提交于 2020-06-28 06:01:40
问题 With browser Web API, I'd like to set MediaDevices.getUserMedia constraints attributes, suitable to record audio speech (voice messages), e.g. setting these parameters: mono 16bit 16KHz Here my code: const mediaStreamConstraints = { audio: { channelCount: 1, sampleRate: 16000, sampleSize: 16, volume: 1 }, video: false } navigator.mediaDevices.getUserMedia(mediaStreamConstraints) .catch( err => serverlog(`ERROR mediaDevices.getUserMedia: ${err}`) ) .then( stream => { // audio recorded as Blob

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

回眸只為那壹抹淺笑 提交于 2020-02-03 04:34:09
问题 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 capturing. Of course, it is possible to check for 'getDisplayMedia' in navigator.mediaDevices , but this just tells us if the API is supported by the browser. In particular, on FF and Chrome on Android, the API is defined and I can call getDisplayMedia

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

☆樱花仙子☆ 提交于 2019-12-24 00:23:49
问题 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 then we capture their audio stream let enumDevicePromise = navigator.mediaDevices.enumerateDevices() .then(devices => devices.find(d => d.kind === "audioinput" && d.label !== "" && d.deviceId === "default")) .catch((error) => { // handle error });