refactor: update LiveKit egress service and module structure
- Removed the `livekit.egress.ts` file and replaced it with `livekit.egress.service.ts` for better clarity and consistency in naming. - Updated `livekit.module.ts` to reflect the new import path for the `LiveKitEgressService`. - Enhanced `livekit.room.service.ts` to utilize the new egress service structure, including improved egress configuration for recording sessions with dynamic file output settings. - Removed the `rootDir` property from `tsconfig.json` to streamline the TypeScript configuration.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { Module, Global } from '@nestjs/common'
|
import { Module, Global } from '@nestjs/common'
|
||||||
import { LiveKitService } from './livekit.service'
|
import { LiveKitService } from './livekit.service'
|
||||||
import { LiveKitRoomService } from './livekit.room.service'
|
import { LiveKitRoomService } from './livekit.room.service'
|
||||||
import { LiveKitEgressService } from './livekit.egress'
|
import { LiveKitEgressService } from './livekit.egress.service'
|
||||||
@Global()
|
@Global()
|
||||||
@Module({
|
@Module({
|
||||||
providers: [LiveKitService, LiveKitRoomService, LiveKitEgressService],
|
providers: [LiveKitService, LiveKitRoomService, LiveKitEgressService],
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
|
import {
|
||||||
|
Room,
|
||||||
|
RoomServiceClient,
|
||||||
|
RoomEgress,
|
||||||
|
AutoTrackEgress,
|
||||||
|
AutoParticipantEgress,
|
||||||
|
EncodedFileType,
|
||||||
|
EncodedFileOutput,
|
||||||
|
RoomCompositeEgressRequest,
|
||||||
|
EncodingOptionsPreset,
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import { Room, RoomServiceClient, RoomEgress } from 'livekit-server-sdk'
|
} from 'livekit-server-sdk'
|
||||||
import { LiveKitEgressService } from './livekit.egress'
|
import { LiveKitEgressService } from './livekit.egress.service'
|
||||||
import { DateTimeUtils } from 'src/common/utils/datetime.utils'
|
import { DateTimeUtils } from 'src/common/utils/datetime.utils'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -27,7 +37,18 @@ export class LiveKitRoomService {
|
|||||||
name: roomId,
|
name: roomId,
|
||||||
maxParticipants: 2,
|
maxParticipants: 2,
|
||||||
egress: new RoomEgress({
|
egress: new RoomEgress({
|
||||||
tracks: {
|
room: new RoomCompositeEgressRequest({
|
||||||
|
layout: 'grid',
|
||||||
|
options: {
|
||||||
|
case: 'preset',
|
||||||
|
value: EncodingOptionsPreset.H264_1080P_60,
|
||||||
|
},
|
||||||
|
audioOnly: false,
|
||||||
|
videoOnly: false,
|
||||||
|
fileOutputs: [
|
||||||
|
{
|
||||||
|
fileType: EncodedFileType.MP4,
|
||||||
|
filepath: `epess/records/${roomId}/${roomId}-${DateTimeUtils.now().toISO()}`,
|
||||||
output: {
|
output: {
|
||||||
case: 's3',
|
case: 's3',
|
||||||
value: {
|
value: {
|
||||||
@@ -38,10 +59,10 @@ export class LiveKitRoomService {
|
|||||||
region: process.env.MINIO_REGION,
|
region: process.env.MINIO_REGION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
filepath: `epess/records/${roomId}/${roomId}-${DateTimeUtils.now().toISO()}`,
|
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
departureTimeout: 1000 * 60 * 10, // 10 minutes
|
|
||||||
})
|
})
|
||||||
return room
|
return room
|
||||||
}
|
}
|
||||||
@@ -51,7 +72,17 @@ export class LiveKitRoomService {
|
|||||||
name: roomId,
|
name: roomId,
|
||||||
maxParticipants,
|
maxParticipants,
|
||||||
egress: new RoomEgress({
|
egress: new RoomEgress({
|
||||||
tracks: {
|
room: new RoomCompositeEgressRequest({
|
||||||
|
layout: 'spotlight',
|
||||||
|
options: {
|
||||||
|
case: 'preset',
|
||||||
|
value: EncodingOptionsPreset.H264_1080P_60,
|
||||||
|
},
|
||||||
|
audioOnly: false,
|
||||||
|
videoOnly: false,
|
||||||
|
fileOutputs: [
|
||||||
|
{
|
||||||
|
fileType: EncodedFileType.MP4,
|
||||||
output: {
|
output: {
|
||||||
case: 's3',
|
case: 's3',
|
||||||
value: {
|
value: {
|
||||||
@@ -64,6 +95,8 @@ export class LiveKitRoomService {
|
|||||||
},
|
},
|
||||||
filepath: `epess/records/${roomId}/${roomId}-${DateTimeUtils.now().toISO()}`,
|
filepath: `epess/records/${roomId}/${roomId}-${DateTimeUtils.now().toISO()}`,
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
return room
|
return room
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"rootDir": "./src",
|
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user