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