0.1.6 • Published 6 months ago
@cameratag/react_camera v0.1.6
CameraTag's Video Recorder
This react component allows you to embed a CameraTag <Camera> video recorder in your React app.
Initialize A Recorder
Below is an example of how to load a <Camera> in your app and (optionally) grab a handle to the object to be able to call methods / observe events from our JS API.
import Camera from "@cameratag/react_camera";
export default function App() {
return <Camera appUuid='a-6793d070-dbac-013b-f57a-529b7d4fe95c' id='myCamera'/>
}Call Methods / Observe Events
If you want to call methods on the <Camera> from our JS API you can pass a function into the onInit prop and the function will be passed a handle to the newly initialized <Camera>.
import Camera from "@cameratag/react_camera";
export default function App() {
function getHandle(recorder) {
// you can call then call API methods or observe events
recorder.record();
recorder.observe("recordingStarted", ()=>{
console.log("You're recording!");
});
}
return <Camera onInit={getHandle} appUuid='a-6793d070-dbac-013b-f57a-529b7d4fe95c' id='myCamera'/>
}