-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from yewon830/feat/share-webcam
[Feat] 화상회의 OpenVidu 튜토리얼 코드 참조, 화상회의 UI 수정
- Loading branch information
Showing
8 changed files
with
542 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.stream-container { | ||
padding: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.