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