day len server theo loi Khoi noi, toi xin tuyen bo mien tru trach nhiem
This commit is contained in:
7
src/LiveKit/livekit.module.ts
Normal file
7
src/LiveKit/livekit.module.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
// import { Module } from '@nestjs/common'
|
||||
// import { LiveKitService } from './livekit.service'
|
||||
// @Module({
|
||||
// providers: [LiveKitService],
|
||||
// exports: [LiveKitService],
|
||||
// })
|
||||
// export class LiveKitModule {}
|
||||
24
src/LiveKit/livekit.participant.service.ts
Normal file
24
src/LiveKit/livekit.participant.service.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
// @ts-ignore
|
||||
import { AccessToken } from 'livekit-server-sdk'
|
||||
|
||||
@Injectable()
|
||||
export class LiveKitParticipantService {
|
||||
async createAccessToken(participantId: string) {
|
||||
return new AccessToken(
|
||||
process.env.LIVEKIT_API_KEY,
|
||||
process.env.LIVEKIT_API_SECRET,
|
||||
{
|
||||
identity: participantId,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
async grantRoomJoinPermission(token: AccessToken, roomName: string) {
|
||||
token.addGrant({ roomJoin: true, room: roomName })
|
||||
}
|
||||
|
||||
async toJWT(token: AccessToken) {
|
||||
return token.toJwt()
|
||||
}
|
||||
}
|
||||
36
src/LiveKit/livekit.room.service.ts
Normal file
36
src/LiveKit/livekit.room.service.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
// import {
|
||||
// Room,
|
||||
// RoomServiceClient,
|
||||
// RoomCompositeOptions,
|
||||
// // @ts-ignore
|
||||
// } from 'livekit-server-sdk'
|
||||
// import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
// export class LiveKitRoomService {
|
||||
// private roomServiceClient: RoomServiceClient
|
||||
|
||||
// constructor() {
|
||||
// this.roomServiceClient = new RoomServiceClient(
|
||||
// process.env.LIVEKIT_URL as string,
|
||||
// process.env.LIVEKIT_API_KEY as string,
|
||||
// process.env.LIVEKIT_API_SECRET as string,
|
||||
// )
|
||||
// }
|
||||
|
||||
// async createServiceMeetingRoom(chattingRoomId: string) {
|
||||
// const room = await this.roomServiceClient.createRoom({
|
||||
// maxParticipants: 3,
|
||||
// name: chattingRoomId,
|
||||
// })
|
||||
|
||||
// return room
|
||||
// }
|
||||
|
||||
// async createWorkshopMeetingRoom(workshopId: string, maxParticipants: number) {
|
||||
// const room = await this.roomServiceClient.createRoom({
|
||||
// maxParticipants: maxParticipants,
|
||||
// name: workshopId,
|
||||
// })
|
||||
// return room
|
||||
// }
|
||||
// }
|
||||
11
src/LiveKit/livekit.service.ts
Normal file
11
src/LiveKit/livekit.service.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// import { Injectable, OnModuleInit } from '@nestjs/common'
|
||||
// import { LiveKitRoomService } from './livekit.room.service'
|
||||
|
||||
// @Injectable()
|
||||
// export class LiveKitService implements OnModuleInit {
|
||||
// private liveKitRoomService: LiveKitRoomService
|
||||
// async onModuleInit() {
|
||||
// // init livekit room service
|
||||
// this.liveKitRoomService = new LiveKitRoomService()
|
||||
// }
|
||||
// }
|
||||
5
src/LiveKit/livekit.track.service.ts
Normal file
5
src/LiveKit/livekit.track.service.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// @ts-ignore
|
||||
import { TrackInfo } from 'livekit-server-sdk'
|
||||
|
||||
export class LiveKitTrackService {
|
||||
}
|
||||
Reference in New Issue
Block a user