mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
no need to stop from server
This commit is contained in:
@@ -89,7 +89,7 @@ export default function Recorder(props) {
|
|||||||
const handleRecClick = async () => {
|
const handleRecClick = async () => {
|
||||||
if (!record) return console.log("no record");
|
if (!record) return console.log("no record");
|
||||||
|
|
||||||
if (record?.isRecording()) {
|
if (record.isRecording()) {
|
||||||
props.onStop();
|
props.onStop();
|
||||||
record.stopRecording();
|
record.stopRecording();
|
||||||
setIsRecording(false);
|
setIsRecording(false);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Peer from "simple-peer";
|
|||||||
|
|
||||||
const WebRTC_SERVER_URL = "http://127.0.0.1:1250/offer";
|
const WebRTC_SERVER_URL = "http://127.0.0.1:1250/offer";
|
||||||
|
|
||||||
const useWebRTC = (stream, setIsRecording) => {
|
const useWebRTC = (stream) => {
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
peer: null,
|
peer: null,
|
||||||
});
|
});
|
||||||
@@ -66,7 +66,6 @@ const useWebRTC = (stream, setIsRecording) => {
|
|||||||
},
|
},
|
||||||
text: ''
|
text: ''
|
||||||
}));
|
}));
|
||||||
setIsRecording(false);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error(`Unknown command ${serverData.cmd}`);
|
console.error(`Unknown command ${serverData.cmd}`);
|
||||||
@@ -76,7 +75,7 @@ const useWebRTC = (stream, setIsRecording) => {
|
|||||||
return () => {
|
return () => {
|
||||||
peer.destroy();
|
peer.destroy();
|
||||||
};
|
};
|
||||||
}, [stream, setIsRecording]);
|
}, [stream]);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const App = () => {
|
|||||||
|
|
||||||
// This is where you'd send the stream and receive the data from the server.
|
// This is where you'd send the stream and receive the data from the server.
|
||||||
// transcription, summary, etc
|
// transcription, summary, etc
|
||||||
const serverData = useWebRTC(stream, () => { });
|
const serverData = useWebRTC(stream);
|
||||||
|
|
||||||
const sendStopCmd = () => serverData?.peer?.send(JSON.stringify({ cmd: "STOP" }))
|
const sendStopCmd = () => serverData?.peer?.send(JSON.stringify({ cmd: "STOP" }))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user