DefinitelyTyped/types/react-webcam/react-webcam-tests.tsx
Søren Englund 5dcf97395a Updated types for newest version of react-webcam
Updated types for newest version of react-webcam

Updated tests

Updated types for newest version of react-webcam

Updated types for newest version of react-webcam

Updated types for newest version of react-webcam

Updated tests

Added newline to the end of file
2019-04-16 21:47:14 +02:00

37 lines
885 B
TypeScript

import * as React from "react";
import Webcam = require("react-webcam");
export class ReactWebcamTest extends React.Component {
private webcam: Webcam;
setRef = (webcam: Webcam) => {
this.webcam = webcam;
}
capture = () => {
const imageSrc = this.webcam.getScreenshot();
}
render() {
const videoConstraints = {
width: 1280,
height: 720,
facingMode: "user"
};
return (
<div>
<Webcam
audio={false}
height={350}
ref={this.setRef}
screenshotFormat="image/jpeg"
width={350}
videoConstraints={videoConstraints}
/>
<button onClick={this.capture}>Capture photo</button>
</div>
);
}
}