Merge pull request #158 from TeamBNBN/BE/userinfo

feat: video
This commit is contained in:
Jungmin 2024-07-31 16:05:15 +09:00 committed by GitHub
commit fe8e5f1bd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
package com.edufocus.edufocus.video.controller; package com.edufocus.edufocus.video.controller;
import java.util.Map; import java.util.Map;
import java.util.Random;
import com.edufocus.edufocus.lecture.entity.Lecture; import com.edufocus.edufocus.lecture.entity.Lecture;
import com.edufocus.edufocus.lecture.entity.LectureDetailResponse; import com.edufocus.edufocus.lecture.entity.LectureDetailResponse;
@ -95,8 +96,13 @@ public class Controller {
Lecture lecture= lectureRepository.findById(id).orElse(null); 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() ) { if(findUser.getRole()==UserRole.ADMIN ){//&& lecture.isOnline() ) {
@ -107,8 +113,8 @@ public class Controller {
AccessToken token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET); AccessToken token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
token.setName(participantName); token.setName(participantName+randStr);
token.setIdentity(participantName); token.setIdentity(participantName+randStr);
token.addGrants(new RoomJoin(true), new RoomName(roomName), new RoomCreate(true)); token.addGrants(new RoomJoin(true), new RoomName(roomName), new RoomCreate(true));
videoSertvice.startOnline(userId, id); videoSertvice.startOnline(userId, id);
@ -126,8 +132,8 @@ public class Controller {
AccessToken token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET); AccessToken token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
token.setName(participantName); token.setName(participantName+randStr);
token.setIdentity(participantName); token.setIdentity(participantName+randStr);
token.addGrants(new RoomJoin(true), new RoomName(roomName)); token.addGrants(new RoomJoin(true), new RoomName(roomName));