Skip to content

Commit

Permalink
feat: [FE] room의 params에 맞춰서 다른 방에 입장할 수 있는 기능 구현
Browse files Browse the repository at this point in the history
room의 params에 맞춰서 다른 방에 입장할 수 있는 기능 구현
(#20)
  • Loading branch information
d0422 committed Nov 10, 2023
1 parent 550c2ea commit d30ae82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontEnd/src/pages/Room.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from 'react';
import { useParams } from 'react-router-dom';
import { createSocket } from '@/services/Socket';
import { StreamObject, streamModel } from '@/stores/StreamModel';
import { SOCKET_EMIT_EVENT } from '@/constants/socketEvents';
Expand All @@ -16,6 +17,8 @@ function StreamVideo({ stream }: { stream: MediaStream }) {
export default function Room() {
const videoRef = useRef<HTMLVideoElement>(null);
const [stream, setStream] = useState<StreamObject[]>([]);
const { roomId } = useParams();

useEffect(() => {
navigator.mediaDevices
.getUserMedia({
Expand All @@ -29,7 +32,7 @@ export default function Room() {
const socket = createSocket(video);
socket.connect();
socket.emit(SOCKET_EMIT_EVENT.JOIN_ROOM, {
room: '1234',
room: roomId,
});
});
}, []);
Expand Down

0 comments on commit d30ae82

Please sign in to comment.