diff --git a/package.json b/package.json index 8b32284..b152d1c 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ }, "dependencies": { "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "react-icons": "^4.12.0" }, "devDependencies": { "@types/react": "^18.2.37", diff --git a/src/App.tsx b/src/App.tsx index 0e609a0..434b8df 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,7 +19,7 @@ function App() { return ( <> - {showModal && ()} + {showModal && } ) diff --git a/src/components/Header.tsx b/src/components/Header.tsx new file mode 100644 index 0000000..bcb75ab --- /dev/null +++ b/src/components/Header.tsx @@ -0,0 +1,14 @@ +import { MdOutlineExitToApp } from "react-icons/md"; + +const Header = () => { + return ( +
+
방송 주제 텍스트
+ +
+ ) +} + +export default Header diff --git a/src/components/Splash.tsx b/src/components/Splash.tsx index 5746b5a..de00e97 100644 --- a/src/components/Splash.tsx +++ b/src/components/Splash.tsx @@ -1,8 +1,7 @@ const Splash = () => { return ( -
-

NOC

-

News of Citizen

+
+

Service Name

) } diff --git a/src/index.css b/src/index.css index f177d8f..0ba9045 100644 --- a/src/index.css +++ b/src/index.css @@ -2,15 +2,15 @@ @tailwind components; @tailwind utilities; -html, body { +html, body, #root { height: 100%; width: 100%; + color: white; } .video{ object-fit: cover; - width: 100%; - height: 300px; + height: 100%; background-color: #535bf2; } @@ -27,12 +27,10 @@ html, body { } .splash { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: red; - z-index: 9999; animation: fadeOut 3s ease; } + +.small-button{ + padding: 0.5rem 1rem; + background-color: #000000; +} diff --git a/src/pages/LivePage.tsx b/src/pages/LivePage.tsx index af4594a..4cc1332 100644 --- a/src/pages/LivePage.tsx +++ b/src/pages/LivePage.tsx @@ -1,4 +1,5 @@ import { useRef, useEffect } from "react"; +import Header from "../components/Header.tsx"; const CONSTRAINTS = { video: true, @@ -8,7 +9,31 @@ const CONSTRAINTS = { const LivePage = () => { const liveRef = useRef(null); const mediaRecorderRef = useRef(null); - const chunks: Blob[] = []; + // const chunks: Blob[] = []; + + let sequence = 0 + + const uploadVideo = async (blob: Blob) => { + try { + const formData = new FormData(); + formData.append('file_name', String(sequence)); // 원하는 파일 이름으로 설정 + formData.append('video', blob); + + const response = await fetch('http://13.209.86.34:5001/api/video/upload', { + method: 'POST', + body: formData, + }); + + if (response.ok) { + const responseData = await response.json(); + console.log('서버 응답:', responseData); + } else { + console.error('서버 응답 오류:', response.status, response.statusText); + } + } catch (error) { + console.error('API 요청 중 에러:', error); + } + }; const startLive = async () => { try { @@ -25,9 +50,9 @@ const LivePage = () => { // 녹화가 준비되었을 때 이벤트 처리 mediaRecorderRef.current.ondataavailable = (e) => { if (e.data.size > 0) { - chunks.push(e.data); + uploadVideo(e.data); + console.log('onDataAvailable', e.data); } - console.log('onDataAvailable', e.data); }; // 녹화 중지 시 이벤트 처리 @@ -55,10 +80,13 @@ const LivePage = () => { return ( <> -
LivePage
-