Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 화상회의 OpenVidu 튜토리얼 코드 참조, 화상회의 UI 수정 #222

Merged
merged 4 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"axios": "^1.7.2",
"express": "^4.19.2",
"jwt-decode": "^4.0.0",
"openvidu-browser": "^2.30.1",
"phaser": "^3.80.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
75 changes: 0 additions & 75 deletions front/server/signalingServer.ts

This file was deleted.

3 changes: 3 additions & 0 deletions front/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.stream-container {
padding: 0;
}
22 changes: 22 additions & 0 deletions front/src/components/VideoCall/OpenViduVideoComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { StreamManager } from 'openvidu-browser';
import React, { useRef, useEffect } from 'react';


interface OpenViduVideoComponentProps {
streamManager: StreamManager | undefined;
}

// 최종적으로 미디어 스트림을 표시하는 최종 HTMl 래핑.
const OpenViduVideoComponent: React.FC<OpenViduVideoComponentProps> = ({ streamManager }) => {
const videoRef = useRef<HTMLVideoElement>(null); // videoRef의 타입을 HTMLVideoElement로 지정

useEffect(() => {
if (streamManager && videoRef.current) {
streamManager.addVideoElement(videoRef.current);
}
}, [streamManager]);

return <video className='w-40 h-32 rounded-lg' autoPlay ref={videoRef} />;
}

export default OpenViduVideoComponent;
31 changes: 31 additions & 0 deletions front/src/components/VideoCall/UserVideoComponents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import OpenViduVideoComponent from './OpenViduVideoComponent';
import './UserVideo.css';
import { StreamManager } from 'openvidu-browser';
import { Box } from '@mui/material';


interface UserVideoComponentProps {
streamManager: StreamManager
}
// 모든 사용자 비디오 표시, 클릭이벤트 처리
const UserVideoComponent: React.FC<UserVideoComponentProps> = ({ streamManager }) => {
const getNicknameTag = (): string => {
// Gets the nickName of the user
return JSON.parse(streamManager!.stream.connection.data).clientData;
}

return (
<Box sx={{height: '100%'}}>
{streamManager !== undefined ? (
<Box sx={{width: '100%', height: '100%', backgroundColor: 'black', borderRadius: '10px', position: 'relative'}}>
{/* OpenViduVideoComponent : 사용자 비디오 컴포넌트 */}
<OpenViduVideoComponent streamManager={streamManager}/>
<div><p className='text-white absolute bottom-0 left-0'>{getNicknameTag()}</p></div>
</Box>
) : null}
</Box>
);
}

export default UserVideoComponent;
Loading