openvidu-java-client/openvidu-node-client: new RecordingProperties defaults

pull/621/head
pabloFuente 2021-04-09 17:32:33 +02:00
parent 1d026e4a7d
commit e38c7e4a6c
6 changed files with 244 additions and 205 deletions

View File

@ -196,26 +196,8 @@ public class OpenVidu {
HttpPost request = new HttpPost(this.hostname + API_RECORDINGS_START); HttpPost request = new HttpPost(this.hostname + API_RECORDINGS_START);
JsonObject json = new JsonObject(); JsonObject json = properties.toJson();
json.addProperty("session", sessionId); json.addProperty("session", sessionId);
json.addProperty("name", properties.name());
json.addProperty("outputMode", properties.outputMode() != null ? properties.outputMode().name() : null);
json.addProperty("hasAudio", properties.hasAudio());
json.addProperty("hasVideo", properties.hasVideo());
json.addProperty("shmSize", properties.shmSize());
json.addProperty("mediaNode", properties.mediaNode());
if ((properties.outputMode() == null || Recording.OutputMode.COMPOSED.equals(properties.outputMode())
|| (Recording.OutputMode.COMPOSED_QUICK_START.equals(properties.outputMode())))
&& properties.hasVideo()) {
json.addProperty("resolution", properties.resolution());
json.addProperty("frameRate", properties.frameRate());
json.addProperty("recordingLayout",
(properties.recordingLayout() != null) ? properties.recordingLayout().name() : "");
if (RecordingLayout.CUSTOM.equals(properties.recordingLayout())) {
json.addProperty("customLayout", (properties.customLayout() != null) ? properties.customLayout() : "");
}
}
StringEntity params = null; StringEntity params = null;
try { try {

View File

@ -159,6 +159,22 @@ public class Recording {
return this.recordingProperties.name(); return this.recordingProperties.name();
} }
/**
* <code>true</code> if the recording has an audio track, <code>false</code>
* otherwise (currently fixed to true)
*/
public boolean hasAudio() {
return this.recordingProperties.hasAudio();
}
/**
* <code>true</code> if the recording has a video track, <code>false</code>
* otherwise (currently fixed to true)
*/
public boolean hasVideo() {
return this.recordingProperties.hasVideo();
}
/** /**
* Mode of recording: COMPOSED for a single archive in a grid layout or * Mode of recording: COMPOSED for a single archive in a grid layout or
* INDIVIDUAL for one archive for each stream * INDIVIDUAL for one archive for each stream
@ -249,24 +265,8 @@ public class Recording {
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} and * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} and
* {@link Recording#hasVideo()} is true * {@link Recording#hasVideo()} is true
*/ */
public int getFrameRate() { public Integer getFrameRate() {
return this.recordingProperties.frameRate(); return this.recordingProperties.frameRate();
} }
/**
* <code>true</code> if the recording has an audio track, <code>false</code>
* otherwise (currently fixed to true)
*/
public boolean hasAudio() {
return this.recordingProperties.hasAudio();
}
/**
* <code>true</code> if the recording has a video track, <code>false</code>
* otherwise (currently fixed to true)
*/
public boolean hasVideo() {
return this.recordingProperties.hasVideo();
}
} }

View File

@ -27,15 +27,29 @@ import io.openvidu.java.client.Recording.OutputMode;
*/ */
public class RecordingProperties { public class RecordingProperties {
private String name; public static class DefaultValues {
private Recording.OutputMode outputMode; public static final Boolean hasAudio = true;
public static final Boolean hasVideo = true;
public static final Recording.OutputMode outputMode = Recording.OutputMode.COMPOSED;
public static final RecordingLayout recordingLayout = RecordingLayout.BEST_FIT;
public static final String resolution = "1280x720";
public static final Integer frameRate = 25;
public static final Long shmSize = 536870912L;
}
// For all
private String name = "";
private Boolean hasAudio = true;
private Boolean hasVideo = true;
private Recording.OutputMode outputMode = Recording.OutputMode.COMPOSED;
// For COMPOSED/COMPOSED_QUICK_START + hasVideo
private RecordingLayout recordingLayout; private RecordingLayout recordingLayout;
private String customLayout;
private String resolution; private String resolution;
private int frameRate; private Integer frameRate;
private boolean hasAudio; private Long shmSize;
private boolean hasVideo; // For COMPOSED/COMPOSED_QUICK_START + hasVideo + RecordingLayout.CUSTOM
private long shmSize; // For COMPOSED recording private String customLayout;
// For OpenVidu Pro
private String mediaNode; private String mediaNode;
/** /**
@ -44,14 +58,14 @@ public class RecordingProperties {
public static class Builder { public static class Builder {
private String name = ""; private String name = "";
private Boolean hasAudio = true;
private Boolean hasVideo = true;
private Recording.OutputMode outputMode = Recording.OutputMode.COMPOSED; private Recording.OutputMode outputMode = Recording.OutputMode.COMPOSED;
private RecordingLayout recordingLayout = RecordingLayout.BEST_FIT; private RecordingLayout recordingLayout;
private String customLayout = ""; private String resolution;
private String resolution = "1280x720"; private Integer frameRate;
private int frameRate = 25; private Long shmSize;
private boolean hasAudio = true; private String customLayout;
private boolean hasVideo = true;
private long shmSize = 536870912L;
private String mediaNode; private String mediaNode;
public Builder() { public Builder() {
@ -59,14 +73,14 @@ public class RecordingProperties {
public Builder(RecordingProperties props) { public Builder(RecordingProperties props) {
this.name = props.name(); this.name = props.name();
this.outputMode = props.outputMode();
this.recordingLayout = props.recordingLayout();
this.customLayout = props.customLayout();
this.resolution = props.resolution();
this.frameRate = props.frameRate();
this.hasAudio = props.hasAudio(); this.hasAudio = props.hasAudio();
this.hasVideo = props.hasVideo(); this.hasVideo = props.hasVideo();
this.outputMode = props.outputMode();
this.recordingLayout = props.recordingLayout();
this.resolution = props.resolution();
this.frameRate = props.frameRate();
this.shmSize = props.shmSize(); this.shmSize = props.shmSize();
this.customLayout = props.customLayout();
this.mediaNode = props.mediaNode(); this.mediaNode = props.mediaNode();
} }
@ -74,8 +88,9 @@ public class RecordingProperties {
* Builder for {@link io.openvidu.java.client.RecordingProperties} * Builder for {@link io.openvidu.java.client.RecordingProperties}
*/ */
public RecordingProperties build() { public RecordingProperties build() {
return new RecordingProperties(this.name, this.outputMode, this.recordingLayout, this.customLayout, return new RecordingProperties(this.name, this.hasAudio, this.hasVideo, this.outputMode,
this.resolution, this.frameRate, this.hasAudio, this.hasVideo, this.shmSize, this.mediaNode); this.recordingLayout, this.resolution, this.frameRate, this.shmSize, this.customLayout,
this.mediaNode);
} }
/** /**
@ -86,6 +101,26 @@ public class RecordingProperties {
return this; return this;
} }
/**
* Call this method to specify whether to record audio or not. Cannot be set to
* false at the same time as
* {@link RecordingProperties.Builder#hasVideo(boolean)}
*/
public RecordingProperties.Builder hasAudio(boolean hasAudio) {
this.hasAudio = hasAudio;
return this;
}
/**
* Call this method to specify whether to record video or not. Cannot be set to
* false at the same time as
* {@link RecordingProperties.Builder#hasAudio(boolean)}
*/
public RecordingProperties.Builder hasVideo(boolean hasVideo) {
this.hasVideo = hasVideo;
return this;
}
/** /**
* Call this method to set the mode of recording: * Call this method to set the mode of recording:
* {@link Recording.OutputMode#COMPOSED} or * {@link Recording.OutputMode#COMPOSED} or
@ -109,21 +144,6 @@ public class RecordingProperties {
return this; return this;
} }
/**
* If setting
* {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)}
* to {@link io.openvidu.java.client.RecordingLayout#CUSTOM} you can call this
* method to set the relative path to the specific custom layout you want to
* use.<br>
* See <a href=
* "https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more
*/
public RecordingProperties.Builder customLayout(String path) {
this.customLayout = path;
return this;
}
/** /**
* Call this method to specify the recording resolution. Must be a string with * Call this method to specify the recording resolution. Must be a string with
* format "WIDTHxHEIGHT", being both WIDTH and HEIGHT the number of pixels * format "WIDTHxHEIGHT", being both WIDTH and HEIGHT the number of pixels
@ -157,26 +177,6 @@ public class RecordingProperties {
return this; return this;
} }
/**
* Call this method to specify whether to record audio or not. Cannot be set to
* false at the same time as
* {@link RecordingProperties.Builder#hasVideo(boolean)}
*/
public RecordingProperties.Builder hasAudio(boolean hasAudio) {
this.hasAudio = hasAudio;
return this;
}
/**
* Call this method to specify whether to record video or not. Cannot be set to
* false at the same time as
* {@link RecordingProperties.Builder#hasAudio(boolean)}
*/
public RecordingProperties.Builder hasVideo(boolean hasVideo) {
this.hasVideo = hasVideo;
return this;
}
/** /**
* Call this method to specify the amount of shared memory reserved for the * Call this method to specify the amount of shared memory reserved for the
* recording process in bytes. Minimum 134217728 (128MB).<br> * recording process in bytes. Minimum 134217728 (128MB).<br>
@ -191,6 +191,21 @@ public class RecordingProperties {
return this; return this;
} }
/**
* If setting
* {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)}
* to {@link io.openvidu.java.client.RecordingLayout#CUSTOM} you can call this
* method to set the relative path to the specific custom layout you want to
* use.<br>
* See <a href=
* "https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more
*/
public RecordingProperties.Builder customLayout(String path) {
this.customLayout = path;
return this;
}
/** /**
* <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" * <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank"
* style="display: inline-block; background-color: rgb(0, 136, 170); color: * style="display: inline-block; background-color: rgb(0, 136, 170); color:
@ -210,18 +225,23 @@ public class RecordingProperties {
} }
protected RecordingProperties(String name, Recording.OutputMode outputMode, RecordingLayout layout, protected RecordingProperties(String name, Boolean hasAudio, Boolean hasVideo, Recording.OutputMode outputMode,
String customLayout, String resolution, int frameRate, boolean hasAudio, boolean hasVideo, long shmSize, RecordingLayout layout, String resolution, Integer frameRate, Long shmSize, String customLayout,
String mediaNode) { String mediaNode) {
this.name = name; this.name = name != null ? name : "";
this.outputMode = outputMode; this.hasAudio = hasAudio != null ? hasAudio : DefaultValues.hasAudio;
this.recordingLayout = layout; this.hasVideo = hasVideo != null ? hasVideo : DefaultValues.hasVideo;
this.outputMode = outputMode != null ? outputMode : DefaultValues.outputMode;
if ((OutputMode.COMPOSED.equals(this.outputMode) || OutputMode.COMPOSED_QUICK_START.equals(this.outputMode))
&& this.hasVideo) {
this.recordingLayout = layout != null ? layout : DefaultValues.recordingLayout;
this.resolution = resolution != null ? resolution : DefaultValues.resolution;
this.frameRate = frameRate != null ? frameRate : DefaultValues.frameRate;
this.shmSize = shmSize != null ? shmSize : DefaultValues.shmSize;
if (RecordingLayout.CUSTOM.equals(this.recordingLayout)) {
this.customLayout = customLayout; this.customLayout = customLayout;
this.resolution = resolution; }
this.frameRate = frameRate; }
this.hasAudio = hasAudio;
this.hasVideo = hasVideo;
this.shmSize = shmSize;
this.mediaNode = mediaNode; this.mediaNode = mediaNode;
} }
@ -232,6 +252,28 @@ public class RecordingProperties {
return this.name; return this.name;
} }
/**
* Defines whether to record audio or not. Cannot be set to false at the same
* time as {@link RecordingProperties#hasVideo()}.<br>
* <br>
*
* Default to true
*/
public Boolean hasAudio() {
return this.hasAudio;
}
/**
* Defines whether to record video or not. Cannot be set to false at the same
* time as {@link RecordingProperties#hasAudio()}.<br>
* <br>
*
* Default to true
*/
public Boolean hasVideo() {
return this.hasVideo;
}
/** /**
* Defines the mode of recording: {@link Recording.OutputMode#COMPOSED} or * Defines the mode of recording: {@link Recording.OutputMode#COMPOSED} or
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} for * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} for
@ -260,18 +302,6 @@ public class RecordingProperties {
return this.recordingLayout; return this.recordingLayout;
} }
/**
* If {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} is
* set to {@link io.openvidu.java.client.RecordingLayout#CUSTOM}, this property
* defines the relative path to the specific custom layout you want to use.<br>
* See <a href=
* "https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more
*/
public String customLayout() {
return this.customLayout;
}
/** /**
* Defines the resolution of the recorded video.<br> * Defines the resolution of the recorded video.<br>
* Will only have effect for * Will only have effect for
@ -304,32 +334,10 @@ public class RecordingProperties {
* *
* Default to 25 * Default to 25
*/ */
public int frameRate() { public Integer frameRate() {
return this.frameRate; return this.frameRate;
} }
/**
* Defines whether to record audio or not. Cannot be set to false at the same
* time as {@link RecordingProperties#hasVideo()}.<br>
* <br>
*
* Default to true
*/
public boolean hasAudio() {
return this.hasAudio;
}
/**
* Defines whether to record video or not. Cannot be set to false at the same
* time as {@link RecordingProperties#hasAudio()}.<br>
* <br>
*
* Default to true
*/
public boolean hasVideo() {
return this.hasVideo;
}
/** /**
* The amount of shared memory reserved for the recording process in bytes. * The amount of shared memory reserved for the recording process in bytes.
* Minimum 134217728 (128MB).<br> * Minimum 134217728 (128MB).<br>
@ -342,10 +350,22 @@ public class RecordingProperties {
* *
* Default to 536870912 (512 MB) * Default to 536870912 (512 MB)
*/ */
public long shmSize() { public Long shmSize() {
return this.shmSize; return this.shmSize;
} }
/**
* If {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} is
* set to {@link io.openvidu.java.client.RecordingLayout#CUSTOM}, this property
* defines the relative path to the specific custom layout you want to use.<br>
* See <a href=
* "https://docs.openvidu.io/en/stable/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more
*/
public String customLayout() {
return this.customLayout;
}
/** /**
* <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" * <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank"
* style="display: inline-block; background-color: rgb(0, 136, 170); color: * style="display: inline-block; background-color: rgb(0, 136, 170); color:
@ -367,17 +387,19 @@ public class RecordingProperties {
public JsonObject toJson() { public JsonObject toJson() {
JsonObject json = new JsonObject(); JsonObject json = new JsonObject();
json.addProperty("name", name); json.addProperty("name", name);
json.addProperty("outputMode", outputMode.name()); json.addProperty("hasAudio", hasAudio != null ? hasAudio : DefaultValues.hasAudio);
json.addProperty("hasAudio", hasAudio); json.addProperty("hasVideo", hasVideo != null ? hasVideo : DefaultValues.hasVideo);
json.addProperty("hasVideo", hasVideo); json.addProperty("outputMode", outputMode != null ? outputMode.name() : DefaultValues.outputMode.name());
if (OutputMode.COMPOSED.equals(outputMode) || OutputMode.COMPOSED_QUICK_START.equals(outputMode)) { if ((OutputMode.COMPOSED.equals(outputMode) || OutputMode.COMPOSED_QUICK_START.equals(outputMode))
json.addProperty("recordingLayout", recordingLayout.name()); && hasVideo) {
json.addProperty("recordingLayout",
recordingLayout != null ? recordingLayout.name() : DefaultValues.recordingLayout.name());
json.addProperty("resolution", resolution != null ? resolution : DefaultValues.resolution);
json.addProperty("frameRate", frameRate != null ? frameRate : DefaultValues.frameRate);
json.addProperty("shmSize", shmSize != null ? shmSize : DefaultValues.shmSize);
if (RecordingLayout.CUSTOM.equals(recordingLayout)) { if (RecordingLayout.CUSTOM.equals(recordingLayout)) {
json.addProperty("customLayout", customLayout); json.addProperty("customLayout", customLayout != null ? customLayout : "");
} }
json.addProperty("resolution", resolution);
json.addProperty("frameRate", frameRate);
json.addProperty("shmSize", shmSize);
} }
if (this.mediaNode != null) { if (this.mediaNode != null) {
json.addProperty("mediaNode", mediaNode); json.addProperty("mediaNode", mediaNode);
@ -386,18 +408,31 @@ public class RecordingProperties {
} }
public static RecordingProperties fromJson(JsonObject json) { public static RecordingProperties fromJson(JsonObject json) {
Boolean hasVideoAux = true;
Recording.OutputMode outputModeAux = null;
RecordingLayout recordingLayoutAux = null;
Builder builder = new RecordingProperties.Builder(); Builder builder = new RecordingProperties.Builder();
if (json.has("name")) { if (json.has("name")) {
builder.name(json.get("name").getAsString()); builder.name(json.get("name").getAsString());
} }
if (json.has("hasAudio")) {
builder.hasAudio(json.get("hasAudio").getAsBoolean());
}
if (json.has("hasVideo")) {
hasVideoAux = json.get("hasVideo").getAsBoolean();
builder.hasVideo(hasVideoAux);
}
if (json.has("outputMode")) { if (json.has("outputMode")) {
builder.outputMode(OutputMode.valueOf(json.get("outputMode").getAsString())); outputModeAux = OutputMode.valueOf(json.get("outputMode").getAsString());
builder.outputMode(outputModeAux);
} }
if ((OutputMode.COMPOSED.equals(outputModeAux) || OutputMode.COMPOSED_QUICK_START.equals(outputModeAux))
&& hasVideoAux) {
if (json.has("recordingLayout")) { if (json.has("recordingLayout")) {
builder.recordingLayout(RecordingLayout.valueOf(json.get("recordingLayout").getAsString())); recordingLayoutAux = RecordingLayout.valueOf(json.get("recordingLayout").getAsString());
} builder.recordingLayout(recordingLayoutAux);
if (json.has("customLayout")) {
builder.customLayout(json.get("customLayout").getAsString());
} }
if (json.has("resolution")) { if (json.has("resolution")) {
builder.resolution(json.get("resolution").getAsString()); builder.resolution(json.get("resolution").getAsString());
@ -405,15 +440,15 @@ public class RecordingProperties {
if (json.has("frameRate")) { if (json.has("frameRate")) {
builder.frameRate(json.get("frameRate").getAsInt()); builder.frameRate(json.get("frameRate").getAsInt());
} }
if (json.has("hasAudio")) {
builder.hasAudio(json.get("hasAudio").getAsBoolean());
}
if (json.has("hasVideo")) {
builder.hasVideo(json.get("hasVideo").getAsBoolean());
}
if (json.has("shmSize")) { if (json.has("shmSize")) {
builder.shmSize(json.get("shmSize").getAsLong()); builder.shmSize(json.get("shmSize").getAsLong());
} }
if (RecordingLayout.CUSTOM.equals(recordingLayoutAux)) {
if (json.has("customLayout")) {
builder.customLayout(json.get("customLayout").getAsString());
}
}
}
if (json.has("mediaNode")) { if (json.has("mediaNode")) {
builder.mediaNode(json.get("mediaNode").getAsString()); builder.mediaNode(json.get("mediaNode").getAsString());
} }

View File

@ -77,17 +77,21 @@ export class Recording {
this.url = json['url']; this.url = json['url'];
this.status = json['status']; this.status = json['status'];
this.properties = { this.properties = {
name: !!(json['name']) ? json['name'] : this.id, name: (json['name'] != null) ? json['name'] : this.id,
outputMode: !!(json['outputMode']) ? json['outputMode'] : Recording.OutputMode.COMPOSED, hasAudio: (json['hasAudio'] != null) ? !!json['hasAudio'] : Recording.DefaultRecordingPropertiesValues.hasAudio,
hasAudio: !!(json['hasAudio']), hasVideo: (json['hasVideo'] != null) ? !!json['hasVideo'] : Recording.DefaultRecordingPropertiesValues.hasVideo,
hasVideo: !!json['hasVideo'] outputMode: (json['outputMode'] != null) ? json['outputMode'] : Recording.DefaultRecordingPropertiesValues.outputMode,
mediaNode: json['mediaNode']
}; };
if (this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.COMPOSED] if ((this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.COMPOSED]
|| this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.COMPOSED_QUICK_START]) { || this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.COMPOSED_QUICK_START])
this.properties.resolution = !!(json['resolution']) ? json['resolution'] : '1280x720'; && this.properties.hasVideo) {
this.properties.recordingLayout = !!(json['recordingLayout']) ? json['recordingLayout'] : RecordingLayout.BEST_FIT; this.properties.recordingLayout = (json['recordingLayout'] != null) ? json['recordingLayout'] : Recording.DefaultRecordingPropertiesValues.recordingLayout;
this.properties.resolution = (json['resolution'] != null) ? json['resolution'] : Recording.DefaultRecordingPropertiesValues.resolution;
this.properties.frameRate = (json['frameRate'] != null) ? Number(json['frameRate']) : Recording.DefaultRecordingPropertiesValues.frameRate;
this.properties.shmSize = (json['shmSize'] != null) ? Number(json['shmSize']) : Recording.DefaultRecordingPropertiesValues.shmSize;
if (this.properties.recordingLayout.toString() === RecordingLayout[RecordingLayout.CUSTOM]) { if (this.properties.recordingLayout.toString() === RecordingLayout[RecordingLayout.CUSTOM]) {
this.properties.customLayout = json['customLayout']; this.properties.customLayout = (json['customLayout'] != null) ? json['customLayout'] : '';
} }
} }
} }
@ -165,4 +169,18 @@ export namespace Recording {
*/ */
INDIVIDUAL = 'INDIVIDUAL' INDIVIDUAL = 'INDIVIDUAL'
} }
/**
* @hidden
*/
export class DefaultRecordingPropertiesValues {
static readonly hasAudio: boolean = true;
static readonly hasVideo: boolean = true;
static readonly outputMode: Recording.OutputMode = Recording.OutputMode.COMPOSED;
static readonly recordingLayout: RecordingLayout = RecordingLayout.BEST_FIT;
static readonly resolution: string = "1280x720";
static readonly frameRate: number = 25;
static readonly shmSize: number = 536870912;
}
} }

View File

@ -30,6 +30,20 @@ export interface RecordingProperties {
*/ */
name?: string; name?: string;
/**
* Whether or not to record audio. Cannot be set to false at the same time as [[RecordingProperties.hasVideo]]
*
* Default to true
*/
hasAudio?: boolean;
/**
* Whether or not to record video. Cannot be set to false at the same time as [[RecordingProperties.hasAudio]]
*
* Default to true
*/
hasVideo?: boolean;
/** /**
* The mode of recording: COMPOSED for a single archive in a grid layout or INDIVIDUAL for one archive for each stream * The mode of recording: COMPOSED for a single archive in a grid layout or INDIVIDUAL for one archive for each stream
* *
@ -45,13 +59,6 @@ export interface RecordingProperties {
*/ */
recordingLayout?: RecordingLayout; recordingLayout?: RecordingLayout;
/**
* The relative path to the specific custom layout you want to use.<br>
* Will only have effect if [[RecordingProperties.outputMode]] is `COMPOSED` (or `COMPOSED_QUICK_START`) and [[RecordingProperties.recordingLayout]] is `CUSTOM`<br>
* See [Custom recording layouts](/en/stable/advanced-features/recording#custom-recording-layouts) to learn more.
*/
customLayout?: string;
/** /**
* Recording video file resolution. Must be a string with format "WIDTHxHEIGHT", * Recording video file resolution. Must be a string with format "WIDTHxHEIGHT",
* being both WIDTH and HEIGHT the number of pixels between 100 and 1999.<br> * being both WIDTH and HEIGHT the number of pixels between 100 and 1999.<br>
@ -72,20 +79,6 @@ export interface RecordingProperties {
*/ */
frameRate?: number; frameRate?: number;
/**
* Whether or not to record audio. Cannot be set to false at the same time as [[RecordingProperties.hasVideo]]
*
* Default to true
*/
hasAudio?: boolean;
/**
* Whether or not to record video. Cannot be set to false at the same time as [[RecordingProperties.hasAudio]]
*
* Default to true
*/
hasVideo?: boolean;
/** /**
* The amount of shared memory reserved for the recording process in bytes. * The amount of shared memory reserved for the recording process in bytes.
* Will only have effect if [[RecordingProperties.outputMode]] is set to [[Recording.OutputMode.COMPOSED]] or [[Recording.OutputMode.COMPOSED_QUICK_START]] * Will only have effect if [[RecordingProperties.outputMode]] is set to [[Recording.OutputMode.COMPOSED]] or [[Recording.OutputMode.COMPOSED_QUICK_START]]
@ -96,6 +89,13 @@ export interface RecordingProperties {
*/ */
shmSize?: number; shmSize?: number;
/**
* The relative path to the specific custom layout you want to use.<br>
* Will only have effect if [[RecordingProperties.outputMode]] is `COMPOSED` (or `COMPOSED_QUICK_START`) and [[RecordingProperties.recordingLayout]] is `CUSTOM`<br>
* See [Custom recording layouts](/en/stable/advanced-features/recording#custom-recording-layouts) to learn more.
*/
customLayout?: string;
/** /**
* **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a> * **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
* *

View File

@ -656,17 +656,21 @@ export class Session {
this.properties.mediaMode = !!this.properties.mediaMode ? this.properties.mediaMode : MediaMode.ROUTED; this.properties.mediaMode = !!this.properties.mediaMode ? this.properties.mediaMode : MediaMode.ROUTED;
this.properties.recordingMode = !!this.properties.recordingMode ? this.properties.recordingMode : RecordingMode.MANUAL; this.properties.recordingMode = !!this.properties.recordingMode ? this.properties.recordingMode : RecordingMode.MANUAL;
this.properties.defaultRecordingProperties = { this.properties.defaultRecordingProperties = {
name: !!this.properties.defaultRecordingProperties?.name ? this.properties.defaultRecordingProperties?.name : '', name: !!this.properties.defaultRecordingProperties?.name ? this.properties.defaultRecordingProperties.name : '',
outputMode: !!this.properties.defaultRecordingProperties?.outputMode ? this.properties.defaultRecordingProperties?.outputMode : Recording.OutputMode.COMPOSED, hasAudio: !!this.properties.defaultRecordingProperties?.hasAudio ? this.properties.defaultRecordingProperties.hasAudio : true,
recordingLayout: !!this.properties.defaultRecordingProperties?.recordingLayout ? this.properties.defaultRecordingProperties?.recordingLayout : RecordingLayout.BEST_FIT, hasVideo: !!this.properties.defaultRecordingProperties?.hasVideo ? this.properties.defaultRecordingProperties.hasVideo : true,
customLayout: !!this.properties.defaultRecordingProperties?.customLayout ? this.properties.defaultRecordingProperties?.customLayout : '', outputMode: !!this.properties.defaultRecordingProperties?.outputMode ? this.properties.defaultRecordingProperties.outputMode : Recording.OutputMode.COMPOSED,
resolution: !!this.properties.defaultRecordingProperties?.resolution ? this.properties.defaultRecordingProperties?.resolution : '1280x720',
frameRate: !!this.properties.defaultRecordingProperties?.frameRate ? this.properties.defaultRecordingProperties?.frameRate : 25,
hasAudio: !!this.properties.defaultRecordingProperties?.hasAudio ? this.properties.defaultRecordingProperties?.hasAudio : true,
hasVideo: !!this.properties.defaultRecordingProperties?.hasVideo ? this.properties.defaultRecordingProperties?.hasVideo : true,
shmSize: !!this.properties.defaultRecordingProperties?.shmSize ? this.properties.defaultRecordingProperties?.shmSize : 536870912,
mediaNode: this.properties.defaultRecordingProperties?.mediaNode mediaNode: this.properties.defaultRecordingProperties?.mediaNode
}; };
if ((this.properties.defaultRecordingProperties.outputMode === Recording.OutputMode.COMPOSED || this.properties.defaultRecordingProperties.outputMode == Recording.OutputMode.COMPOSED_QUICK_START) && this.properties.defaultRecordingProperties.hasVideo) {
this.properties.defaultRecordingProperties.recordingLayout = !!this.properties.defaultRecordingProperties.recordingLayout ? this.properties.defaultRecordingProperties.recordingLayout : RecordingLayout.BEST_FIT;
this.properties.defaultRecordingProperties.resolution = !!this.properties.defaultRecordingProperties.resolution ? this.properties.defaultRecordingProperties.resolution : '1280x720';
this.properties.defaultRecordingProperties.frameRate = !!this.properties.defaultRecordingProperties.frameRate ? this.properties.defaultRecordingProperties.frameRate : 25;
this.properties.defaultRecordingProperties.shmSize = !!this.properties.defaultRecordingProperties.shmSize ? this.properties.defaultRecordingProperties.shmSize : 536870912;
if (this.properties.defaultRecordingProperties.recordingLayout === RecordingLayout.CUSTOM) {
this.properties.defaultRecordingProperties.customLayout = !!this.properties.defaultRecordingProperties.customLayout ? this.properties.defaultRecordingProperties.customLayout : '';
}
}
this.properties.customSessionId = !!this.properties.customSessionId ? this.properties.customSessionId : ''; this.properties.customSessionId = !!this.properties.customSessionId ? this.properties.customSessionId : '';
this.properties.mediaNode = !!this.properties.mediaNode ? this.properties.mediaNode : undefined; this.properties.mediaNode = !!this.properties.mediaNode ? this.properties.mediaNode : undefined;
this.properties.forcedVideoCodec = !!this.properties.forcedVideoCodec ? this.properties.forcedVideoCodec : VideoCodec.VP8; this.properties.forcedVideoCodec = !!this.properties.forcedVideoCodec ? this.properties.forcedVideoCodec : VideoCodec.VP8;