From 4a3ab2f08b5c153448f44d065609ebcc1b6cc0c3 Mon Sep 17 00:00:00 2001 From: Eunseo Sim <55528304+simeunseo@users.noreply.github.com> Date: Wed, 4 Dec 2024 03:05:18 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9D=B4=EB=AF=B8=20=EB=85=B9=EC=9D=8C?= =?UTF-8?q?=20=EB=B2=84=ED=8A=BC=EC=9D=84=20=EB=88=8C=EB=A0=80=EB=8B=A4?= =?UTF-8?q?=EB=A9=B4=20=EB=8B=A4=EC=8B=9C=20=EB=88=84=EB=A5=B4=EC=A7=80=20?= =?UTF-8?q?=EB=AA=BB=ED=95=98=EA=B2=8C=20=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/live/SettingDialog/AiSummary.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/live/SettingDialog/AiSummary.tsx b/apps/web/src/components/live/SettingDialog/AiSummary.tsx index 2e860f1a..13bfaa2d 100644 --- a/apps/web/src/components/live/SettingDialog/AiSummary.tsx +++ b/apps/web/src/components/live/SettingDialog/AiSummary.tsx @@ -1,5 +1,5 @@ import { useParams } from '@tanstack/react-router'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { SOCKET_EVENTS } from '@repo/mediasoup'; import Button from '@/components/common/Button'; @@ -8,15 +8,23 @@ import { useMediasoupState } from '@/contexts/mediasoup/context'; 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(() => { + if (!socket) return; + socket.emit(SOCKET_EVENTS.getIsRecording, { roomId }, (res) => { + const { isRecording } = res; + setIsRecording(isRecording); + }); + }, []); + return (