From 0fc9ed2c49d6219bc31af1d12188074df1d81c11 Mon Sep 17 00:00:00 2001 From: Francisco Baio Dias Date: Fri, 30 Nov 2018 11:55:37 +0100 Subject: [PATCH] fix: isVideoInputSupported check --- src/video-recorder.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/video-recorder.js b/src/video-recorder.js index 7bbf01b..d679145 100644 --- a/src/video-recorder.js +++ b/src/video-recorder.js @@ -57,13 +57,6 @@ const Video = styled.video` ${props => props.onClick && 'cursor: pointer;'}; ` -const isIOSSafari = () => { - const ua = window.navigator.userAgent - const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i) - const webkit = !!ua.match(/WebKit/i) - return iOS && webkit -} - const captureThumb = videoTag => new Promise((resolve, reject) => { const canvas = document.createElement('canvas') @@ -110,7 +103,9 @@ export default class VideoRecorder extends Component { const isInlineRecordingSupported = !!window.MediaSource && !!window.MediaRecorder - const isVideoInputSupported = isIOSSafari() + + const isVideoInputSupported = + document.createElement('input').capture !== undefined this.state = { isRecording: false,