mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
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
37 lines
885 B
TypeScript
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>
|
|
);
|
|
}
|
|
}
|