From 7e0e460078ce70d5f9274c26e6502b470c39892d Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Tue, 11 May 2021 13:00:08 +0200 Subject: [PATCH] openvidu-node-client: RecordingProperties#ignoreFailedStream --- openvidu-node-client/src/Recording.ts | 4 ++++ .../src/RecordingProperties.ts | 23 +++++++++++++++---- openvidu-node-client/src/Session.ts | 17 ++++++++------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/openvidu-node-client/src/Recording.ts b/openvidu-node-client/src/Recording.ts index 0952e85c..42e95c53 100644 --- a/openvidu-node-client/src/Recording.ts +++ b/openvidu-node-client/src/Recording.ts @@ -94,6 +94,9 @@ export class Recording { this.properties.customLayout = (json['customLayout'] != null) ? json['customLayout'] : ''; } } + if (this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.INDIVIDUAL]) { + this.properties.ignoreFailedStreams = (json['ignoreFailedStreams'] != null) ? !!json['ignoreFailedStreams'] : Recording.DefaultRecordingPropertiesValues.ignoreFailedStreams; + } } /* tslint:enable:no-string-literal */ } @@ -181,6 +184,7 @@ export namespace Recording { static readonly resolution: string = "1280x720"; static readonly frameRate: number = 25; static readonly shmSize: number = 536870912; + static readonly ignoreFailedStreams: boolean = false; } } \ No newline at end of file diff --git a/openvidu-node-client/src/RecordingProperties.ts b/openvidu-node-client/src/RecordingProperties.ts index fee030fd..2bc3bfd2 100644 --- a/openvidu-node-client/src/RecordingProperties.ts +++ b/openvidu-node-client/src/RecordingProperties.ts @@ -53,7 +53,7 @@ export interface RecordingProperties { /** * The layout to be used in the recording.
- * Will only have effect if [[RecordingProperties.outputMode]] is `COMPOSED` or `COMPOSED_QUICK_START` + * Will only have effect if [[RecordingProperties.outputMode]] is set to [[Recording.OutputMode.COMPOSED]] or [[Recording.OutputMode.COMPOSED_QUICK_START]] * * Default to [[RecordingLayout.BEST_FIT]] */ @@ -71,9 +71,8 @@ export interface RecordingProperties { /** * Recording video file frame rate.
- * Will only have effect if [[RecordingProperties.outputMode]] - * is set to [[Recording.OutputMode.COMPOSED]] or [[Recording.OutputMode.COMPOSED_QUICK_START]] and [[RecordingProperties.hasVideo]] is set to true. - * For [[Recording.OutputMode.INDIVIDUAL]] all individual video files will have the native frame rate of the published stream. + * Will only have effect if [[RecordingProperties.outputMode]] is set to [[Recording.OutputMode.COMPOSED]] or [[Recording.OutputMode.COMPOSED_QUICK_START]] + * and [[RecordingProperties.hasVideo]] is set to true. For [[Recording.OutputMode.INDIVIDUAL]] all individual video files will have the native frame rate of the published stream. * * Default to 25 */ @@ -91,11 +90,25 @@ export interface RecordingProperties { /** * The relative path to the specific custom layout you want to use.
- * Will only have effect if [[RecordingProperties.outputMode]] is `COMPOSED` (or `COMPOSED_QUICK_START`) and [[RecordingProperties.recordingLayout]] is `CUSTOM`
+ * Will only have effect if [[RecordingProperties.outputMode]] is set to [[Recording.OutputMode.COMPOSED]] or [[Recording.OutputMode.COMPOSED_QUICK_START]] + * and [[RecordingProperties.recordingLayout]] is set to [[RecordingLayout.CUSTOM]]
* See [Custom recording layouts](/en/stable/advanced-features/recording#custom-recording-layouts) to learn more. */ customLayout?: string; + /** + * Whether to ignore failed streams or not when starting the recording. This property only applies if [[RecordingProperties.outputMode]] is set to [[Recording.OutputMode.INDIVIDUAL]]. + * For this type of recordings, when calling [[OpenVidu.startRecording]] by default all the streams available at the moment the recording process starts must be healthy + * and properly sending media. If some stream that should be sending media is broken, then the recording process fails after a 10s timeout. In this way your application is notified + * that some stream is not being recorded, so it can retry the process again. + * + * But you can disable this rollback behavior and simply ignore any failed stream, which will be susceptible to be recorded in the future if media starts flowing as expected at any point. + * The downside of this behavior is that you will have no guarantee that all streams present at the beginning of a recording are actually being recorded. + * + * Default to false + */ + ignoreFailedStreams?: boolean; + /** * **This feature is part of OpenVidu Pro tier** PRO * diff --git a/openvidu-node-client/src/Session.ts b/openvidu-node-client/src/Session.ts index cebe5c36..7a2fa28d 100644 --- a/openvidu-node-client/src/Session.ts +++ b/openvidu-node-client/src/Session.ts @@ -667,19 +667,22 @@ export class Session { props.defaultRecordingProperties = {}; } props.defaultRecordingProperties.name = (props.defaultRecordingProperties?.name != null) ? props.defaultRecordingProperties.name : ''; - props.defaultRecordingProperties.hasAudio = (props.defaultRecordingProperties?.hasAudio != null) ? props.defaultRecordingProperties.hasAudio : true; - props.defaultRecordingProperties.hasVideo = (props.defaultRecordingProperties?.hasVideo != null) ? props.defaultRecordingProperties.hasVideo : true; - props.defaultRecordingProperties.outputMode = (props.defaultRecordingProperties?.outputMode != null) ? props.defaultRecordingProperties.outputMode : Recording.OutputMode.COMPOSED; + props.defaultRecordingProperties.hasAudio = (props.defaultRecordingProperties?.hasAudio != null) ? props.defaultRecordingProperties.hasAudio : Recording.DefaultRecordingPropertiesValues.hasAudio; + props.defaultRecordingProperties.hasVideo = (props.defaultRecordingProperties?.hasVideo != null) ? props.defaultRecordingProperties.hasVideo : Recording.DefaultRecordingPropertiesValues.hasVideo; + props.defaultRecordingProperties.outputMode = (props.defaultRecordingProperties?.outputMode != null) ? props.defaultRecordingProperties.outputMode : Recording.DefaultRecordingPropertiesValues.outputMode; props.defaultRecordingProperties.mediaNode = props.defaultRecordingProperties?.mediaNode; if ((props.defaultRecordingProperties.outputMode === Recording.OutputMode.COMPOSED || props.defaultRecordingProperties.outputMode == Recording.OutputMode.COMPOSED_QUICK_START) && props.defaultRecordingProperties.hasVideo) { - props.defaultRecordingProperties.recordingLayout = (props.defaultRecordingProperties.recordingLayout != null) ? props.defaultRecordingProperties.recordingLayout : RecordingLayout.BEST_FIT; - props.defaultRecordingProperties.resolution = (props.defaultRecordingProperties.resolution != null) ? props.defaultRecordingProperties.resolution : '1280x720'; - props.defaultRecordingProperties.frameRate = (props.defaultRecordingProperties.frameRate != null) ? props.defaultRecordingProperties.frameRate : 25; - props.defaultRecordingProperties.shmSize = (props.defaultRecordingProperties.shmSize != null) ? props.defaultRecordingProperties.shmSize : 536870912; + props.defaultRecordingProperties.recordingLayout = (props.defaultRecordingProperties.recordingLayout != null) ? props.defaultRecordingProperties.recordingLayout : Recording.DefaultRecordingPropertiesValues.recordingLayout; + props.defaultRecordingProperties.resolution = (props.defaultRecordingProperties.resolution != null) ? props.defaultRecordingProperties.resolution : Recording.DefaultRecordingPropertiesValues.resolution; + props.defaultRecordingProperties.frameRate = (props.defaultRecordingProperties.frameRate != null) ? props.defaultRecordingProperties.frameRate : Recording.DefaultRecordingPropertiesValues.frameRate; + props.defaultRecordingProperties.shmSize = (props.defaultRecordingProperties.shmSize != null) ? props.defaultRecordingProperties.shmSize : Recording.DefaultRecordingPropertiesValues.shmSize; if (props.defaultRecordingProperties.recordingLayout === RecordingLayout.CUSTOM) { props.defaultRecordingProperties.customLayout = (props.defaultRecordingProperties.customLayout != null) ? props.defaultRecordingProperties.customLayout : ''; } } + if (props.defaultRecordingProperties.outputMode === Recording.OutputMode.INDIVIDUAL) { + props.defaultRecordingProperties.ignoreFailedStreams = (props.defaultRecordingProperties?.ignoreFailedStreams != null) ? props.defaultRecordingProperties.ignoreFailedStreams : Recording.DefaultRecordingPropertiesValues.ignoreFailedStreams; + } this.formatMediaNodeObjectIfNecessary(props.defaultRecordingProperties); this.formatMediaNodeObjectIfNecessary(props);