mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
Full back end integration
This commit is contained in:
@@ -1,21 +1,4 @@
|
||||
export default function Record(props) {
|
||||
let mediaRecorder = null; // mediaRecorder instance
|
||||
|
||||
const startRecording = () => {
|
||||
navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
|
||||
mediaRecorder = new MediaRecorder(stream);
|
||||
mediaRecorder.start();
|
||||
props.onRecord(true);
|
||||
});
|
||||
};
|
||||
|
||||
const stopRecording = () => {
|
||||
if (mediaRecorder) {
|
||||
mediaRecorder.stop();
|
||||
props.onRecord(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col justify-center h-screen">
|
||||
<div className="text-center py-6 mt-10">
|
||||
@@ -25,11 +8,11 @@ export default function Record(props) {
|
||||
|
||||
<div className="flex flex-col items-center justify-center flex-grow -mt-10">
|
||||
{!props.isRecording ? (
|
||||
<button onClick={startRecording} data-color="blue">
|
||||
<button onClick={() => props.onRecord(true)} data-color="blue">
|
||||
Record
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={stopRecording} data-color="red">
|
||||
<button onClick={() => props.onRecord(false)} data-color="red">
|
||||
Stop
|
||||
</button>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user