diff --git a/backend/openapi/openvidu-meet-api.yaml b/backend/openapi/openvidu-meet-api.yaml index 9f16a35..d3c0fcb 100644 --- a/backend/openapi/openvidu-meet-api.yaml +++ b/backend/openapi/openvidu-meet-api.yaml @@ -428,7 +428,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/MeetRecording' + $ref: '#/components/schemas/MeetRecordingStart' '401': description: Unauthorized — The API key is missing or invalid content: @@ -558,7 +558,7 @@ paths: recordings: type: array items: - $ref: '#/components/schemas/MeetRecording' + $ref: '#/components/schemas/MeetRecording' pagination: type: object properties: @@ -1210,79 +1210,76 @@ components: description: > The URL for the viewer to join the room. The viewer has read-only permissions to watch the room and participants. + MeetRecordingBase: + type: object + properties: + recordingId: + type: string + example: 'room-123--EG_XYZ--XX445' + description: The unique identifier of the recording. + roomId: + type: string + example: 'room-123' + description: The ID of the room where the recording was made. + # outputMode: + # type: string + # example: 'COMPOSED' + # description: > + # The output mode of the recording. Possible value: "COMPOSED". + status: + type: string + example: 'ACTIVE' + description: > + The status of the recording. + Possible values: + - STARTING + - ACTIVE + - ENDING + - COMPLETE + - FAILED + - ABORTED + - LIMITED_REACHED + filename: + type: string + example: 'room-123--XX445.mp4' + description: The name of the recording file. + startDate: + type: number + example: 1620000000000 + description: The date when the recording was started (milliseconds since the Unix epoch). + MeetRecording: - type: object - properties: - recordingId: - type: string - example: 'room-123--EG_XYZ--XX445' - description: > - The unique identifier of the recording. - roomId: - type: string - example: 'room-123' - description: > - The ID of the room where the recording was made. - outputMode: - type: string - example: 'COMPOSED' - description: > - The output mode of the recording. Possible values are "COMPOSED". - status: - type: string - example: 'ACTIVE' - description: > - The status of the recording. - - Possible values: - - `STARTING` - - `ACTIVE` - - `ENDING` - - `COMPLETE` - - `FAILED` - - `ABORTED` - - `LIMITED_REACHED` - - filename: - type: string - example: 'room-123--XX445.mp4' - description: > - The name of the recording file. - startDate: - type: number - example: 1620000000000 - description: > - The date when the recording was started in milliseconds since the Unix epoch. + allOf: + - $ref: '#/components/schemas/MeetRecordingBase' + - type: object + properties: endDate: - type: number - example: 1620000000000 - description: > - The date when the recording was stopped in milliseconds since the Unix epoch. + type: number + example: 1620000000000 + description: The date when the recording was stopped (milliseconds since the Unix epoch). duration: - type: number - example: 3600 - description: > - The duration of the recording in seconds. + type: number + example: 3600 + description: The duration of the recording in seconds. size: - type: number - example: 1024 - description: > - The size of the recording file in bytes. + type: number + example: 1024 + description: The size of the recording file in bytes. errorCode: - type: number - example: 100 - description: > - The error code of the recording. + type: number + example: 100 + description: The error code of the recording. error: - type: string - example: 'error' - description: > - The error message of the recording. + type: string + description: The error message of the recording. + nullable: true details: - type: string - example: 'Stopped using API' - description: > - Additional details about the recording. + type: string + example: 'Stopped using API' + description: Additional details about the recording. + + MeetRecordingStart: + $ref: '#/components/schemas/MeetRecordingBase' Error: type: object required: diff --git a/backend/src/helpers/ov-components-adapter.helper.ts b/backend/src/helpers/ov-components-adapter.helper.ts index 57d0d23..ba4b704 100644 --- a/backend/src/helpers/ov-components-adapter.helper.ts +++ b/backend/src/helpers/ov-components-adapter.helper.ts @@ -47,7 +47,7 @@ export class OpenViduComponentsAdapterHelper { id: info.recordingId, roomName: info.details ?? '', roomId: info.roomId, - outputMode: info.outputMode, + // outputMode: info.outputMode, status: this.mapRecordingStatus(info.status), filename: info.filename, startedAt: info.startDate, diff --git a/backend/src/helpers/recording.helper.ts b/backend/src/helpers/recording.helper.ts index 8fe5c57..463b9ba 100644 --- a/backend/src/helpers/recording.helper.ts +++ b/backend/src/helpers/recording.helper.ts @@ -1,5 +1,5 @@ import { EgressInfo } from 'livekit-server-sdk'; -import { MeetRecordingInfo, MeetRecordingOutputMode, MeetRecordingStatus } from '@typings-ce'; +import { MeetRecordingInfo, MeetRecordingStatus } from '@typings-ce'; import { EgressStatus } from '@livekit/protocol'; export class RecordingHelper { @@ -10,7 +10,7 @@ export class RecordingHelper { static toRecordingInfo(egressInfo: EgressInfo): MeetRecordingInfo { const status = RecordingHelper.extractOpenViduStatus(egressInfo.status); const size = RecordingHelper.extractSize(egressInfo); - const outputMode = RecordingHelper.extractOutputMode(egressInfo); + // const outputMode = RecordingHelper.extractOutputMode(egressInfo); const duration = RecordingHelper.extractDuration(egressInfo); const startDateMs = RecordingHelper.extractStartDate(egressInfo); const endDateMs = RecordingHelper.extractEndDate(egressInfo); @@ -20,16 +20,16 @@ export class RecordingHelper { return { recordingId: `${roomName}--${egressId}--${uid}`, roomId: roomName, - outputMode, + // outputMode, status, filename, startDate: startDateMs, endDate: endDateMs, duration, size, - errorCode, - error, - details: details + errorCode: errorCode ? Number(errorCode) : undefined, + error: error ? String(error) : undefined, + details: details ? String(details) : undefined, }; } @@ -72,14 +72,14 @@ export class RecordingHelper { * @param egressInfo - The egress information containing the roomComposite flag. * @returns The extracted OpenVidu output mode. */ - static extractOutputMode(egressInfo: EgressInfo): MeetRecordingOutputMode { - // if (egressInfo.request.case === 'roomComposite') { - // return MeetRecordingOutputMode.COMPOSED; - // } else { - // return MeetRecordingOutputMode.INDIVIDUAL; - // } - return MeetRecordingOutputMode.COMPOSED; - } + // static extractOutputMode(egressInfo: EgressInfo): MeetRecordingOutputMode { + // // if (egressInfo.request.case === 'roomComposite') { + // // return MeetRecordingOutputMode.COMPOSED; + // // } else { + // // return MeetRecordingOutputMode.INDIVIDUAL; + // // } + // return MeetRecordingOutputMode.COMPOSED; + // } /** * Extracts the filename/path for storing the recording. @@ -133,8 +133,9 @@ export class RecordingHelper { * @param egressInfo The egress information containing the file results. * @returns The duration in milliseconds. */ - static extractDuration(egressInfo: EgressInfo): number { - return this.toSeconds(Number(egressInfo.fileResults?.[0]?.duration ?? 0)); + static extractDuration(egressInfo: EgressInfo): number | undefined { + const duration = this.toSeconds(Number(egressInfo.fileResults?.[0]?.duration ?? 0)); + return duration !== 0 ? duration : undefined; } /** @@ -168,8 +169,9 @@ export class RecordingHelper { * @param egressInfo - The EgressInfo object to extract the size from. * @returns The size extracted from the EgressInfo object, or 0 if not available. */ - static extractSize(egressInfo: EgressInfo): number { - return Number(egressInfo.fileResults?.[0]?.size ?? 0); + static extractSize(egressInfo: EgressInfo): number | undefined { + const size = Number(egressInfo.fileResults?.[0]?.size ?? 0); + return size !== 0 ? size : undefined; } private static toSeconds(nanoseconds: number): number {