diff options
author | Mohammad Amoush <muhammedamoush@gmail.com> | 2019-09-13 16:52:59 -0400 |
---|---|---|
committer | Mohammad Amoush <muhammedamoush@gmail.com> | 2019-09-13 16:52:59 -0400 |
commit | c5a37bcb1e02caec1cbafe737de8c09afe400a79 (patch) | |
tree | 15106ef635b8bd773ecfbb51979346b57b9ea4fe /src | |
parent | ee03fa6e04dd9dba3099f75154de6ffab566ff5c (diff) |
Local WebCam shows up
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/webcam/DashWebCam.tsx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/client/views/webcam/DashWebCam.tsx b/src/client/views/webcam/DashWebCam.tsx index a158938fe..3659bbc6e 100644 --- a/src/client/views/webcam/DashWebCam.tsx +++ b/src/client/views/webcam/DashWebCam.tsx @@ -24,7 +24,7 @@ interface WebcamProps { } @observer -export class DashWebCam extends React.Component<FieldViewProps & WebcamProps & React.HTMLAttributes<HTMLVideoElement>, WebcamState> { +export class DashWebCam extends React.Component<FieldViewProps & WebcamProps & React.HTMLAttributes<HTMLVideoElement>> { static defaultProps = { audio: true, imageSmoothing: true, @@ -54,11 +54,11 @@ export class DashWebCam extends React.Component<FieldViewProps & WebcamProps & R componentDidMount() { if (!hasGetUserMedia()) return; - const { state } = this; + // const { state } = this; DashWebCam.mountedInstances.push(this); - if (!state.hasUserMedia && !DashWebCam.userMediaRequested) { + if (!this.hasUserMedia && !DashWebCam.userMediaRequested) { this.requestUserMedia(); } } @@ -154,7 +154,7 @@ export class DashWebCam extends React.Component<FieldViewProps & WebcamProps & R navigator.getUserMedia = navigator.mediaDevices.getUserMedia; - const sourceSelected = (audioConstraints, videoConstraints) => { + const sourceSelected = (audioConstraints: any, videoConstraints: any) => { const constraints: MediaStreamConstraints = { video: typeof videoConstraints !== "undefined" ? videoConstraints : true }; @@ -181,9 +181,9 @@ export class DashWebCam extends React.Component<FieldViewProps & WebcamProps & R if ("mediaDevices" in navigator) { sourceSelected(props.audioConstraints, props.videoConstraints); } else { - const optionalSource = id => ({ optional: [{ sourceId: id }] }); + const optionalSource = (id: any) => ({ optional: [{ sourceId: id }] }); - const constraintToSourceId = constraint => { + const constraintToSourceId = (constraint: any) => { const { deviceId } = constraint; if (typeof deviceId === "string") { @@ -206,7 +206,7 @@ export class DashWebCam extends React.Component<FieldViewProps & WebcamProps & R let audioSource = null; let videoSource = null; - sources.forEach(source => { + sources.forEach((source: { kind: string; id: any; }) => { if (source.kind === "audio") { audioSource = source.id; } else if (source.kind === "video") { @@ -234,12 +234,12 @@ export class DashWebCam extends React.Component<FieldViewProps & WebcamProps & R DashWebCam.userMediaRequested = true; } - handleUserMedia(err, stream?: MediaStream) { + handleUserMedia(err: string | null, stream?: MediaStream) { const { props } = this; if (err || !stream) { this.setState({ hasUserMedia: false }); - props.onUserMediaError(err); + props.onUserMediaError(err!); return; } |