From 7d962df5217a1df98dac9b08af759ee178410ef2 Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 15:30:24 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20AiSummary=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EC=97=90=EC=84=9C=20socket=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=A5=BC=20=ED=95=A8=EC=88=98=20=EB=82=B4=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20=EB=B0=8F=20=ED=83=80=EC=9E=85=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/live/SettingDialog/AiSummary.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/live/SettingDialog/AiSummary.tsx b/apps/web/src/components/live/SettingDialog/AiSummary.tsx index 13bfaa2d..a301b0fa 100644 --- a/apps/web/src/components/live/SettingDialog/AiSummary.tsx +++ b/apps/web/src/components/live/SettingDialog/AiSummary.tsx @@ -5,22 +5,32 @@ import { SOCKET_EVENTS } from '@repo/mediasoup'; import Button from '@/components/common/Button'; import { useMediasoupState } from '@/contexts/mediasoup/context'; +interface GetIsRecordingRes { + isRecording: boolean; +} + function AiSummary() { const [isRecording, setIsRecording] = useState(false); const { socketRef } = useMediasoupState(); - const socket = socketRef.current; const { ticleId: roomId } = useParams({ from: '/_authenticated/live/$ticleId' }); const handleRecordStart = () => { + const socket = socketRef.current; + if (!socket) return; + socket.emit(SOCKET_EVENTS.startRecord, { roomId }); setIsRecording(true); }; useEffect(() => { + const socket = socketRef.current; + if (!socket) return; - socket.emit(SOCKET_EVENTS.getIsRecording, { roomId }, (res) => { - const { isRecording } = res; + + socket.emit(SOCKET_EVENTS.getIsRecording, { roomId }, (data: GetIsRecordingRes) => { + const { isRecording } = data; + setIsRecording(isRecording); }); }, []);