From a8df7b39ad6ddc5cca74d951ca4c69cce0c2c5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A0=95=EB=AF=BC?= Date: Wed, 31 Jul 2024 16:04:27 +0900 Subject: [PATCH] feat: video --- .../edufocus/video/controller/Controller.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java b/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java index 4c470ed..99a9494 100644 --- a/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java +++ b/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java @@ -1,6 +1,7 @@ package com.edufocus.edufocus.video.controller; import java.util.Map; +import java.util.Random; import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.lecture.entity.LectureDetailResponse; @@ -95,8 +96,13 @@ public class Controller { Lecture lecture= lectureRepository.findById(id).orElse(null); + Random random = new Random(); + int randomNumber = 100 + random.nextInt(9000); + + String randStr = String.valueOf(randomNumber); + if(findUser.getRole()==UserRole.ADMIN ){//&& lecture.isOnline() ) { @@ -107,8 +113,8 @@ public class Controller { AccessToken token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET); - token.setName(participantName); - token.setIdentity(participantName); + token.setName(participantName+randStr); + token.setIdentity(participantName+randStr); token.addGrants(new RoomJoin(true), new RoomName(roomName), new RoomCreate(true)); videoSertvice.startOnline(userId, id); @@ -126,8 +132,8 @@ public class Controller { AccessToken token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET); - token.setName(participantName); - token.setIdentity(participantName); + token.setName(participantName+randStr); + token.setIdentity(participantName+randStr); token.addGrants(new RoomJoin(true), new RoomName(roomName));