useRecording
useRecording hook allows you to use following methods & states.
Name | Type | Description |
---|---|---|
startRecording() | Function | starts recording the web app on the given sourceUrl |
stoprecording() | Function | stops the recording on the web app |
isStarting | boolean | state whether the recording has started or not |
inProgress | boolean | state whether the recording is in progress |
isStopping | boolean | state whether the recording has stopped or not |
data | data | data of the recording |
error | string | gives the error message |
Sample code
import { useRecording } from '@huddle01/react/hooks';
const App = () => {
const { startRecording,stoprecording, isStarting, inProgress isStopping, error } = useRecording();
if(inProgress) return (<div>...loading</div>)
return (
<div>
<button
disabled={!startRecording.isCallable}
onClick={startRecording};
}>
START_RECORDING
</button>
{isStarting ? "Recording is starting": error}
<button disabled={!stoprecording.isCallable} onClick={stoprecording}>
STOP_RECORDING
</button>
</div>
);
};