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 { LiveKitService } from './livekit.service'
|
||||
import { LiveKitRoomService } from './livekit.room.service'
|
||||
import { LiveKitEgressService } from './livekit.egress'
|
||||
import { LiveKitEgressService } from './livekit.egress.service'
|
||||
@Global()
|
||||
@Module({
|
||||
providers: [LiveKitService, LiveKitRoomService, LiveKitEgressService],
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
// @ts-expect-error
|
||||
import { Room, RoomServiceClient, RoomEgress } from 'livekit-server-sdk'
|
||||
import { LiveKitEgressService } from './livekit.egress'
|
||||
import {
|
||||
Room,
|
||||
RoomServiceClient,
|
||||
RoomEgress,
|
||||
AutoTrackEgress,
|
||||
AutoParticipantEgress,
|
||||
EncodedFileType,
|
||||
EncodedFileOutput,
|
||||
RoomCompositeEgressRequest,
|
||||
EncodingOptionsPreset,
|
||||
// @ts-expect-error
|
||||
} from 'livekit-server-sdk'
|
||||
import { LiveKitEgressService } from './livekit.egress.service'
|
||||
import { DateTimeUtils } from 'src/common/utils/datetime.utils'
|
||||
|
||||
@Injectable()
|
||||
@@ -27,7 +37,18 @@ export class LiveKitRoomService {
|
||||
name: roomId,
|
||||
maxParticipants: 2,
|
||||
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: {
|
||||
case: 's3',
|
||||
value: {
|
||||
@@ -38,10 +59,10 @@ export class LiveKitRoomService {
|
||||
region: process.env.MINIO_REGION,
|
||||
},
|
||||
},
|
||||
filepath: `epess/records/${roomId}/${roomId}-${DateTimeUtils.now().toISO()}`,
|
||||
},
|
||||
],
|
||||
}),
|
||||
}),
|
||||
departureTimeout: 1000 * 60 * 10, // 10 minutes
|
||||
})
|
||||
return room
|
||||
}
|
||||
@@ -51,7 +72,17 @@ export class LiveKitRoomService {
|
||||
name: roomId,
|
||||
maxParticipants,
|
||||
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: {
|
||||
case: 's3',
|
||||
value: {
|
||||
@@ -64,6 +95,8 @@ export class LiveKitRoomService {
|
||||
},
|
||||
filepath: `epess/records/${roomId}/${roomId}-${DateTimeUtils.now().toISO()}`,
|
||||
},
|
||||
],
|
||||
}),
|
||||
}),
|
||||
})
|
||||
return room
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
"rootDir": "./src",
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"strictNullChecks": true,
|
||||
|
||||
Reference in New Issue
Block a user