From 7db323dece5da3ba02ab30b95c2596cb291f3ea8 Mon Sep 17 00:00:00 2001 From: Alex Antonov Date: Sun, 10 Apr 2022 19:28:24 +0300 Subject: [PATCH] fix: video is not muted in constraints (#156) --- package.json | 1 + src/video-recorder.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 6b4378b..767276d 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ }, "dependencies": { "fix-webm-duration": "^1.0.4", + "lodash.clonedeep": "^4.5.0", "react-svg-inline": "^2.1.0" }, "devDependencies": { diff --git a/src/video-recorder.js b/src/video-recorder.js index a238e4a..a597f81 100644 --- a/src/video-recorder.js +++ b/src/video-recorder.js @@ -1,5 +1,6 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' +import cloneDeep from 'lodash.clonedeep' import styled, { css } from 'styled-components' import fixWebmDuration from 'fix-webm-duration' @@ -254,14 +255,16 @@ export default class VideoRecorder extends Component { video: true } - const currentConstraints = { - ...this.props.constraints, - video: { - deviceId: { - exact: currentDeviceId + const currentConstraints = cloneDeep( + { + video: { + deviceId: { + exact: currentDeviceId + } } - } - } + }, + this.props.constraints + ) navigator.mediaDevices .getUserMedia(currentConstraints)