diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenVidu.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenVidu.java
index 502a458d..09cf7b3e 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenVidu.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenVidu.java
@@ -258,12 +258,10 @@ public class OpenVidu {
* Starts the recording of a {@link io.openvidu.java.client.Session}
*
* @param sessionId The sessionId of the session you want to start recording
- * @param name The name you want to give to the video file. You can access
- * this same value in your clients on recording events
- * (recordingStarted, recordingStopped). WARNING: this
- * parameter follows an overwriting policy. If you
- * name two recordings the same, the newest MP4 file will
- * overwrite the oldest one
+ * @param name The name you want to give to the video file.
+ * WARNING: this parameter follows an overwriting
+ * policy. If you name two recordings the same, the
+ * newest MP4 file will overwrite the oldest one
*
* @return The started recording. If this method successfully returns the
* Recording object it means that the recording can be stopped with
diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java
index b984ed8f..2a22e3c9 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/Recording.java
@@ -153,9 +153,7 @@ public class Recording {
}
/**
- * Name of the recording. The video file will be named after this property. You
- * can access this same value in your clients on recording events
- * (recordingStarted
, recordingStopped
)
+ * Name of the recording. The video file will be named after this property
*/
public String getName() {
return this.recordingProperties.name();
@@ -170,15 +168,22 @@ public class Recording {
}
/**
- * The layout used in this recording. Only defined if OutputMode is COMPOSED
+ * The layout used in this recording. Only applicable if
+ * {@link io.openvidu.java.client.Recording.OutputMode} is
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} and
+ * {@link Recording#hasVideo()} is true
*/
public RecordingLayout getRecordingLayout() {
return this.recordingProperties.recordingLayout();
}
/**
- * The custom layout used in this recording. Only defined if if OutputMode is
- * COMPOSED and
+ * The custom layout used in this recording. Only applicable if
+ * {@link io.openvidu.java.client.Recording.OutputMode} is
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START},
+ * {@link Recording#hasVideo()} is true and
* {@link io.openvidu.java.client.RecordingProperties.Builder#customLayout(String)}
* has been called
*/
@@ -227,14 +232,27 @@ public class Recording {
}
/**
- * Resolution of the video file. Only defined if OutputMode of the Recording is
- * set to {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * Resolution of the video file. Only applicable if
+ * {@link io.openvidu.java.client.Recording.OutputMode} is
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} and
+ * {@link Recording#hasVideo()} is true
*/
public String getResolution() {
return this.recordingProperties.resolution();
}
+ /**
+ * Frame rate of the video file. Only applicable if
+ * {@link io.openvidu.java.client.Recording.OutputMode} is
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} and
+ * {@link Recording#hasVideo()} is true
+ */
+ public int getFrameRate() {
+ return this.recordingProperties.frameRate();
+ }
+
/**
* true
if the recording has an audio track, false
* otherwise (currently fixed to true)
diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingLayout.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingLayout.java
index 998182dc..700bf2fc 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingLayout.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingLayout.java
@@ -19,9 +19,7 @@ package io.openvidu.java.client;
/**
* See
- * {@link io.openvidu.java.client.SessionProperties.Builder#defaultRecordingLayout(RecordingLayout)}
- * and
- * {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)}
+ * {@link io.openvidu.java.client.RecordingProperties#recordingLayout(RecordingLayout)}
*/
public enum RecordingLayout {
@@ -46,8 +44,8 @@ public enum RecordingLayout {
HORIZONTAL_PRESENTATION,
/**
- * Use your own custom recording layout. See
- * Custom recording layouts to learn more
*/
CUSTOM
diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java
index a88092b1..72e4beab 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/RecordingProperties.java
@@ -17,6 +17,10 @@
package io.openvidu.java.client;
+import com.google.gson.JsonObject;
+
+import io.openvidu.java.client.Recording.OutputMode;
+
/**
* See
* {@link io.openvidu.java.client.OpenVidu#startRecording(String, RecordingProperties)}
@@ -28,6 +32,7 @@ public class RecordingProperties {
private RecordingLayout recordingLayout;
private String customLayout;
private String resolution;
+ private int frameRate;
private boolean hasAudio;
private boolean hasVideo;
private long shmSize; // For COMPOSED recording
@@ -39,27 +44,42 @@ public class RecordingProperties {
public static class Builder {
private String name = "";
- private Recording.OutputMode outputMode;
- private RecordingLayout recordingLayout;
- private String customLayout;
- private String resolution;
+ private Recording.OutputMode outputMode = Recording.OutputMode.COMPOSED;
+ private RecordingLayout recordingLayout = RecordingLayout.BEST_FIT;
+ private String customLayout = "";
+ private String resolution = "1280x720";
+ private int frameRate = 25;
private boolean hasAudio = true;
private boolean hasVideo = true;
private long shmSize = 536870912L;
private String mediaNode;
+ public Builder() {
+ }
+
+ public Builder(RecordingProperties props) {
+ 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.hasVideo = props.hasVideo();
+ this.shmSize = props.shmSize();
+ this.mediaNode = props.mediaNode();
+ }
+
/**
* Builder for {@link io.openvidu.java.client.RecordingProperties}
*/
public RecordingProperties build() {
return new RecordingProperties(this.name, this.outputMode, this.recordingLayout, this.customLayout,
- this.resolution, this.hasAudio, this.hasVideo, this.shmSize, this.mediaNode);
+ this.resolution, this.frameRate, this.hasAudio, this.hasVideo, this.shmSize, this.mediaNode);
}
/**
- * Call this method to set the name of the video file. You can access this same
- * value in your clients on recording events (recordingStarted
,
- * recordingStopped
)
+ * Call this method to set the name of the video file
*/
public RecordingProperties.Builder name(String name) {
this.name = name;
@@ -67,8 +87,11 @@ public class RecordingProperties {
}
/**
- * Call this method to set the mode of recording: COMPOSED for a single archive
- * in a grid layout or INDIVIDUAL for one archive for each stream
+ * Call this method to set the mode of recording:
+ * {@link Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START} for
+ * a single archive in a grid layout or {@link Recording.OutputMode#INDIVIDUAL}
+ * for one archive for each stream.
*/
public RecordingProperties.Builder outputMode(Recording.OutputMode outputMode) {
this.outputMode = outputMode;
@@ -77,11 +100,9 @@ public class RecordingProperties {
/**
* Call this method to set the layout to be used in the recording. Will only
- * have effect if
- * {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)}
- * has been called with value
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * have effect for {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED}
+ * or {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true.
*/
public RecordingProperties.Builder recordingLayout(RecordingLayout layout) {
this.recordingLayout = layout;
@@ -94,13 +115,6 @@ public class RecordingProperties {
* 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.
- * Will only have effect if
- * {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)
- * Builder.outputMode()} has been called with value
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED
- * OutputMode.COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START
- * OutputMode.COMPOSED_QUICK_START}.
* See Custom recording layouts to learn more
@@ -114,22 +128,35 @@ public class RecordingProperties {
* Call this method to specify the recording resolution. Must be a string with
* format "WIDTHxHEIGHT", being both WIDTH and HEIGHT the number of pixels
* between 100 and 1999.
- * Will only have effect if
- * {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)
- * Builder.outputMode()} has been called with value
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED
- * OutputMode.COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START
- * OutputMode.COMPOSED_QUICK_START}. For
- * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL
- * OutputMode.INDIVIDUAL} all individual video files will have the native
- * resolution of the published stream
+ * Will only have effect for
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true. Property
+ * ignored for INDIVIDUAL recordings and audio-only recordings. For
+ * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} all
+ * individual video files will have the native resolution of the published
+ * stream.
*/
public RecordingProperties.Builder resolution(String resolution) {
this.resolution = resolution;
return this;
}
+ /**
+ * Call this method to specify the recording frame rate. Will only have effect
+ * for {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true. Property
+ * ignored for INDIVIDUAL recordings and audio-only recordings. For
+ * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} all
+ * individual video files will have the native frame rate of the published
+ * stream.
+ */
+ public RecordingProperties.Builder frameRate(int frameRate) {
+ this.frameRate = frameRate;
+ return this;
+ }
+
/**
* Call this method to specify whether to record audio or not. Cannot be set to
* false at the same time as
@@ -151,9 +178,13 @@ public class RecordingProperties {
}
/**
- * If COMPOSED recording, call this method to specify the amount of shared
- * memory reserved for the recording process in bytes. Minimum 134217728 (128
- * MB). Property ignored if INDIVIDUAL recording
+ * Call this method to specify the amount of shared memory reserved for the
+ * recording process in bytes. Minimum 134217728 (128MB).
+ * Will only have effect for
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true. Property
+ * ignored for INDIVIDUAL recordings and audio-only recordings
*/
public RecordingProperties.Builder shmSize(long shmSize) {
this.shmSize = shmSize;
@@ -167,8 +198,10 @@ public class RecordingProperties {
* 3px; font-size: 13px; line-height:21px; font-family: Montserrat,
* sans-serif">PRO Call this method to force the recording to be hosted in
* the Media Node with identifier mediaNodeId
. This property only
- * applies to COMPOSED recordings and is ignored for INDIVIDUAL recordings, that
- * are always hosted in the same Media Node hosting its Session
+ * applies to COMPOSED or COMPOSED_QUICK_START recordings with
+ * {@link RecordingProperties#hasVideo()} to true and is ignored for INDIVIDUAL
+ * recordings and audio-only recordings, that are always hosted in the same
+ * Media Node hosting its Session
*/
public RecordingProperties.Builder mediaNode(String mediaNodeId) {
this.mediaNode = mediaNodeId;
@@ -178,13 +211,14 @@ public class RecordingProperties {
}
protected RecordingProperties(String name, Recording.OutputMode outputMode, RecordingLayout layout,
- String customLayout, String resolution, boolean hasAudio, boolean hasVideo, long shmSize,
+ String customLayout, String resolution, int frameRate, boolean hasAudio, boolean hasVideo, long shmSize,
String mediaNode) {
this.name = name;
this.outputMode = outputMode;
this.recordingLayout = layout;
this.customLayout = customLayout;
this.resolution = resolution;
+ this.frameRate = frameRate;
this.hasAudio = hasAudio;
this.hasVideo = hasVideo;
this.shmSize = shmSize;
@@ -192,9 +226,7 @@ public class RecordingProperties {
}
/**
- * Defines the name you want to give to the video file. You can access this same
- * value in your clients on recording events (recordingStarted
,
- * recordingStopped
)
+ * Defines the name you want to give to the video file
*/
public String name() {
return this.name;
@@ -215,12 +247,11 @@ public class RecordingProperties {
/**
* Defines the layout to be used in the recording.
- * Will only have effect if
- * {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)
- * Builder.outputMode()} has been called with value
- * {@link Recording.OutputMode#COMPOSED OutputMode.COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START
- * OutputMode.COMPOSED_QUICK_START}.
+ * Will only have effect for
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true. Property
+ * ignored for INDIVIDUAL recordings and audio-only recordings
*
*
* Default to {@link RecordingLayout#BEST_FIT RecordingLayout.BEST_FIT}
@@ -243,22 +274,40 @@ public class RecordingProperties {
/**
* Defines the resolution of the recorded video.
- * Will only have effect if
- * {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)}
- * has been called with value
+ * Will only have effect for
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}.
- * For {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} all
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true. Property
+ * ignored for INDIVIDUAL recordings and audio-only recordings. For
+ * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} all
* individual video files will have the native resolution of the published
* stream.
*
*
- * Default to "1920x1080"
+ * Default to "1280x720"
*/
public String resolution() {
return this.resolution;
}
+ /**
+ * Defines the frame rate of the recorded video.
+ * Will only have effect for
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true. Property
+ * ignored for INDIVIDUAL recordings and audio-only recordings. For
+ * {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} all
+ * individual video files will have the native frame rate of the published
+ * stream.
+ *
+ *
+ * Default to 25
+ */
+ public int frameRate() {
+ return this.frameRate;
+ }
+
/**
* Defines whether to record audio or not. Cannot be set to false at the same
* time as {@link RecordingProperties#hasVideo()}.
@@ -282,9 +331,13 @@ public class RecordingProperties {
}
/**
- * If COMPOSED recording, the amount of shared memory reserved for the recording
- * process in bytes. Minimum 134217728 (128MB). Property ignored if INDIVIDUAL
- * recording
+ * The amount of shared memory reserved for the recording process in bytes.
+ * Minimum 134217728 (128MB).
+ * Will only have effect for
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
+ * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
+ * recordings with {@link RecordingProperties#hasVideo()} to true. Property
+ * ignored for INDIVIDUAL recordings and audio-only recordings
*
*
* Default to 536870912 (512 MB)
@@ -300,11 +353,71 @@ public class RecordingProperties {
* 3px; font-size: 13px; line-height:21px; font-family: Montserrat,
* sans-serif">PRO The Media Node where to host the recording. The default
* option if this property is not defined is the same Media Node hosting the
- * Session to record. This property only applies to COMPOSED recordings and is
- * ignored for INDIVIDUAL recordings
+ * Session to record. This property only applies to COMPOSED or
+ * COMPOSED_QUICK_START recordings with {@link RecordingProperties#hasVideo()}
+ * to true and is ignored for INDIVIDUAL recordings and audio-only recordings
*/
public String mediaNode() {
return this.mediaNode;
}
+ /**
+ * @hidden
+ */
+ public JsonObject toJson() {
+ JsonObject json = new JsonObject();
+ json.addProperty("name", name);
+ json.addProperty("outputMode", outputMode.name());
+ json.addProperty("hasAudio", hasAudio);
+ json.addProperty("hasVideo", hasVideo);
+ if (OutputMode.COMPOSED.equals(outputMode) || OutputMode.COMPOSED_QUICK_START.equals(outputMode)) {
+ json.addProperty("recordingLayout", recordingLayout.name());
+ if (RecordingLayout.CUSTOM.equals(recordingLayout)) {
+ json.addProperty("customLayout", customLayout);
+ }
+ json.addProperty("resolution", resolution);
+ json.addProperty("frameRate", frameRate);
+ json.addProperty("shmSize", shmSize);
+ }
+ if (this.mediaNode != null) {
+ json.addProperty("mediaNode", mediaNode);
+ }
+ return json;
+ }
+
+ public static RecordingProperties fromJson(JsonObject json) {
+ Builder builder = new RecordingProperties.Builder();
+ if (json.has("name")) {
+ builder.name(json.get("name").getAsString());
+ }
+ if (json.has("outputMode")) {
+ builder.outputMode(OutputMode.valueOf(json.get("outputMode").getAsString()));
+ }
+ if (json.has("recordingLayout")) {
+ builder.recordingLayout(RecordingLayout.valueOf(json.get("recordingLayout").getAsString()));
+ }
+ if (json.has("customLayout")) {
+ builder.customLayout(json.get("customLayout").getAsString());
+ }
+ if (json.has("resolution")) {
+ builder.resolution(json.get("resolution").getAsString());
+ }
+ if (json.has("frameRate")) {
+ 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")) {
+ builder.shmSize(json.get("shmSize").getAsLong());
+ }
+ if (json.has("mediaNode")) {
+ builder.mediaNode(json.get("mediaNode").getAsString());
+ }
+ return builder.build();
+ }
+
}
diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java
index 031db9f2..64d1f76f 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/Session.java
@@ -684,22 +684,17 @@ public class Session {
this.sessionId = responseJson.get("id").getAsString();
this.createdAt = responseJson.get("createdAt").getAsLong();
- // forcedVideoCodec and allowTranscoding values are configured in OpenVidu Server
- // via configuration or session
+ // forcedVideoCodec and allowTranscoding values are configured in OpenVidu
+ // Server via configuration or session
VideoCodec forcedVideoCodec = VideoCodec.valueOf(responseJson.get("forcedVideoCodec").getAsString());
Boolean allowTranscoding = responseJson.get("allowTranscoding").getAsBoolean();
SessionProperties responseProperties = new SessionProperties.Builder()
- .customSessionId(properties.customSessionId())
- .mediaMode(properties.mediaMode())
+ .customSessionId(properties.customSessionId()).mediaMode(properties.mediaMode())
.recordingMode(properties.recordingMode())
- .defaultOutputMode(properties.defaultOutputMode())
- .defaultRecordingLayout(properties.defaultRecordingLayout())
- .defaultCustomLayout(properties.defaultCustomLayout())
- .mediaNode(properties.mediaNode())
- .forcedVideoCodec(forcedVideoCodec)
- .allowTranscoding(allowTranscoding)
- .build();
+ .defaultRecordingProperties(properties.defaultRecordingProperties())
+ .mediaNode(properties.mediaNode()).forcedVideoCodec(forcedVideoCodec)
+ .allowTranscoding(allowTranscoding).build();
this.properties = responseProperties;
log.info("Session '{}' created", this.sessionId);
@@ -734,13 +729,10 @@ public class Session {
this.recording = json.get("recording").getAsBoolean();
SessionProperties.Builder builder = new SessionProperties.Builder()
.mediaMode(MediaMode.valueOf(json.get("mediaMode").getAsString()))
- .recordingMode(RecordingMode.valueOf(json.get("recordingMode").getAsString()))
- .defaultOutputMode(Recording.OutputMode.valueOf(json.get("defaultOutputMode").getAsString()));
- if (json.has("defaultRecordingLayout")) {
- builder.defaultRecordingLayout(RecordingLayout.valueOf(json.get("defaultRecordingLayout").getAsString()));
- }
- if (json.has("defaultCustomLayout")) {
- builder.defaultCustomLayout(json.get("defaultCustomLayout").getAsString());
+ .recordingMode(RecordingMode.valueOf(json.get("recordingMode").getAsString()));
+ if (json.has("defaultRecordingProperties")) {
+ builder.defaultRecordingProperties(
+ RecordingProperties.fromJson(json.get("defaultRecordingProperties").getAsJsonObject()));
}
if (json.has("customSessionId")) {
builder.customSessionId(json.get("customSessionId").getAsString());
@@ -791,10 +783,10 @@ public class Session {
json.addProperty("recording", this.recording);
json.addProperty("mediaMode", this.properties.mediaMode().name());
json.addProperty("recordingMode", this.properties.recordingMode().name());
- json.addProperty("defaultOutputMode", this.properties.defaultOutputMode().name());
- json.addProperty("defaultRecordingLayout", this.properties.defaultRecordingLayout().name());
- json.addProperty("defaultCustomLayout", this.properties.defaultCustomLayout());
- if(this.properties.forcedVideoCodec() != null) {
+ if (this.properties.defaultRecordingProperties() != null) {
+ json.add("defaultRecordingProperties", this.properties.defaultRecordingProperties().toJson());
+ }
+ if (this.properties.forcedVideoCodec() != null) {
json.addProperty("forcedVideoCodec", this.properties.forcedVideoCodec().name());
}
if (this.properties.isTranscodingAllowed() != null) {
diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/SessionProperties.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/SessionProperties.java
index 935b4ed5..98ecebfb 100644
--- a/openvidu-java-client/src/main/java/io/openvidu/java/client/SessionProperties.java
+++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/SessionProperties.java
@@ -19,8 +19,6 @@ package io.openvidu.java.client;
import com.google.gson.JsonObject;
-import io.openvidu.java.client.Recording.OutputMode;
-
/**
* See {@link io.openvidu.java.client.OpenVidu#createSession(SessionProperties)}
*/
@@ -28,9 +26,7 @@ public class SessionProperties {
private MediaMode mediaMode;
private RecordingMode recordingMode;
- private OutputMode defaultOutputMode;
- private RecordingLayout defaultRecordingLayout;
- private String defaultCustomLayout;
+ private RecordingProperties defaultRecordingProperties;
private String customSessionId;
private String mediaNode;
private VideoCodec forcedVideoCodec;
@@ -43,30 +39,26 @@ public class SessionProperties {
private MediaMode mediaMode = MediaMode.ROUTED;
private RecordingMode recordingMode = RecordingMode.MANUAL;
- private OutputMode defaultOutputMode = OutputMode.COMPOSED;
- private RecordingLayout defaultRecordingLayout = RecordingLayout.BEST_FIT;
- private String defaultCustomLayout = "";
+ private RecordingProperties defaultRecordingProperties = new RecordingProperties.Builder().build();
private String customSessionId = "";
private String mediaNode;
- private VideoCodec forcedVideoCodec;
- private Boolean allowTranscoding;
+ private VideoCodec forcedVideoCodec = VideoCodec.VP8;
+ private Boolean allowTranscoding = false;
/**
* Returns the {@link io.openvidu.java.client.SessionProperties} object properly
* configured
*/
public SessionProperties build() {
- return new SessionProperties(this.mediaMode, this.recordingMode, this.defaultOutputMode,
- this.defaultRecordingLayout, this.defaultCustomLayout, this.customSessionId, this.mediaNode,
- this.forcedVideoCodec, this.allowTranscoding);
+ return new SessionProperties(this.mediaMode, this.recordingMode, this.defaultRecordingProperties,
+ this.customSessionId, this.mediaNode, this.forcedVideoCodec, this.allowTranscoding);
}
/**
* Call this method to set how the media streams will be sent and received by
* your clients: routed through OpenVidu Media Node
* (MediaMode.ROUTED
) or attempting direct p2p connections
- * (MediaMode.RELAYED
, not available yet)
- *
+ * (MediaMode.RELAYED
, not available yet)
* Default value is MediaMode.ROUTED
*/
public SessionProperties.Builder mediaMode(MediaMode mediaMode) {
@@ -85,53 +77,14 @@ public class SessionProperties {
}
/**
- * Call this method to set the the default value used to initialize property
- * {@link io.openvidu.java.client.RecordingProperties#outputMode()} of every
- * recording of this session. You can easily override this value later when
- * starting a {@link io.openvidu.java.client.Recording} by calling
- * {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)}
- * with any other value.
- * Default value is {@link Recording.OutputMode#COMPOSED}
+ * Call this method to set the default recording properties of this session. You
+ * can easily override this value later when starting a
+ * {@link io.openvidu.java.client.Recording} by providing new
+ * {@link RecordingProperties}
+ * Default values defined in {@link RecordingProperties} class.
*/
- public SessionProperties.Builder defaultOutputMode(OutputMode outputMode) {
- this.defaultOutputMode = outputMode;
- return this;
- }
-
- /**
- * Call this method to set the the default value used to initialize property
- * {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} of
- * every recording of this session. You can easily override this value later
- * when starting a {@link io.openvidu.java.client.Recording} by calling
- * {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)}
- * with any other value.
- * Default value is {@link RecordingLayout#BEST_FIT}
- *
- * Recording layouts are only applicable to recordings with OutputMode
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
- */
- public SessionProperties.Builder defaultRecordingLayout(RecordingLayout layout) {
- this.defaultRecordingLayout = layout;
- return this;
- }
-
- /**
- * Call this method to set the default value used to initialize property
- * {@link io.openvidu.java.client.RecordingProperties#customLayout()} of every
- * recording of this session. You can easily override this value later when
- * starting a {@link io.openvidu.java.client.Recording} by calling
- * {@link io.openvidu.java.client.RecordingProperties.Builder#customLayout(String)}
- * with any other value.
- *
- *
- * Custom layouts are only applicable to recordings with OutputMode
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} (or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START})
- * and RecordingLayout {@link io.openvidu.java.client.RecordingLayout#CUSTOM}
- */
- public SessionProperties.Builder defaultCustomLayout(String path) {
- this.defaultCustomLayout = path;
+ public SessionProperties.Builder defaultRecordingProperties(RecordingProperties defaultRecordingProperties) {
+ this.defaultRecordingProperties = defaultRecordingProperties;
return this;
}
@@ -161,12 +114,13 @@ public class SessionProperties {
}
/**
- * Call this method to define which video codec do you want to be forcibly used for this session.
- * This allows browsers/clients to use the same codec avoiding transcoding in the media server.
- * If the browser/client is not compatible with the specified codec and {@link #allowTranscoding(Boolean)}
- * is false
and exception will occur.
- *
- * If forcedVideoCodec is set to NONE, no codec will be forced.
+ * Call this method to define which video codec do you want to be forcibly used
+ * for this session. This allows browsers/clients to use the same codec avoiding
+ * transcoding in the media server. If the browser/client is not compatible with
+ * the specified codec and {@link #allowTranscoding(Boolean)} is
+ * false
and exception will occur. If forcedVideoCodec is set to
+ * NONE, no codec will be forced.
+ * Default value is {@link VideoCodec#VP8}
*/
public SessionProperties.Builder forcedVideoCodec(VideoCodec forcedVideoCodec) {
this.forcedVideoCodec = forcedVideoCodec;
@@ -174,8 +128,10 @@ public class SessionProperties {
}
/**
- * Call this method to define if you want to allow transcoding in the media server or not
- * when {@link #forcedVideoCodec(VideoCodec)} is not compatible with the browser/client.
+ * Call this method to define if you want to allow transcoding in the media
+ * server or not when {@link #forcedVideoCodec(VideoCodec)} is not compatible
+ * with the browser/client.
+ * Default value is false
*/
public SessionProperties.Builder allowTranscoding(Boolean allowTranscoding) {
this.allowTranscoding = allowTranscoding;
@@ -187,21 +143,17 @@ public class SessionProperties {
protected SessionProperties() {
this.mediaMode = MediaMode.ROUTED;
this.recordingMode = RecordingMode.MANUAL;
- this.defaultOutputMode = OutputMode.COMPOSED;
- this.defaultRecordingLayout = RecordingLayout.BEST_FIT;
- this.defaultCustomLayout = "";
+ this.defaultRecordingProperties = new RecordingProperties.Builder().build();
this.customSessionId = "";
this.mediaNode = "";
}
- private SessionProperties(MediaMode mediaMode, RecordingMode recordingMode, OutputMode outputMode,
- RecordingLayout layout, String defaultCustomLayout, String customSessionId, String mediaNode,
+ private SessionProperties(MediaMode mediaMode, RecordingMode recordingMode,
+ RecordingProperties defaultRecordingProperties, String customSessionId, String mediaNode,
VideoCodec forcedVideoCodec, Boolean allowTranscoding) {
this.mediaMode = mediaMode;
this.recordingMode = recordingMode;
- this.defaultOutputMode = outputMode;
- this.defaultRecordingLayout = layout;
- this.defaultCustomLayout = defaultCustomLayout;
+ this.defaultRecordingProperties = defaultRecordingProperties;
this.customSessionId = customSessionId;
this.mediaNode = mediaNode;
this.forcedVideoCodec = forcedVideoCodec;
@@ -227,46 +179,13 @@ public class SessionProperties {
}
/**
- * Defines the default value used to initialize property
- * {@link io.openvidu.java.client.RecordingProperties#outputMode()} of every
- * recording of this session. You can easily override this value later when
- * starting a {@link io.openvidu.java.client.Recording} by calling
- * {@link io.openvidu.java.client.RecordingProperties.Builder#outputMode(Recording.OutputMode)}
- * with any other value
+ * Defines the default recording properties of this session. You can easily
+ * override this value later when starting a
+ * {@link io.openvidu.java.client.Recording} by providing new
+ * {@link RecordingProperties}
*/
- public OutputMode defaultOutputMode() {
- return this.defaultOutputMode;
- }
-
- /**
- * Defines the default value used to initialize property
- * {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} of
- * every recording of this session. You can easily override this value later
- * when starting a {@link io.openvidu.java.client.Recording} by calling
- * {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)}
- * with any other value.
- * Recording layouts are only applicable to recordings with OutputMode
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START}
- */
- public RecordingLayout defaultRecordingLayout() {
- return this.defaultRecordingLayout;
- }
-
- /**
- * Defines the default value used to initialize property
- * {@link io.openvidu.java.client.RecordingProperties#customLayout()} of every
- * recording of this session. You can easily override this value later when
- * starting a {@link io.openvidu.java.client.Recording} by calling
- * {@link io.openvidu.java.client.RecordingProperties.Builder#customLayout(String)}
- * with any other value.
- * Custom layouts are only applicable to recordings with OutputMode
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} (or
- * {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED_QUICK_START})
- * and RecordingLayout {@link io.openvidu.java.client.RecordingLayout#CUSTOM}
- */
- public String defaultCustomLayout() {
- return this.defaultCustomLayout;
+ public RecordingProperties defaultRecordingProperties() {
+ return this.defaultRecordingProperties;
}
/**
@@ -301,8 +220,8 @@ public class SessionProperties {
}
/**
- * Defines if transcoding is allowed or not when {@link #forcedVideoCodec}
- * is not a compatible codec with the browser/client.
+ * Defines if transcoding is allowed or not when {@link #forcedVideoCodec} is
+ * not a compatible codec with the browser/client.
*/
public Boolean isTranscodingAllowed() {
return this.allowTranscoding;
@@ -312,10 +231,8 @@ public class SessionProperties {
JsonObject json = new JsonObject();
json.addProperty("mediaMode", mediaMode().name());
json.addProperty("recordingMode", recordingMode().name());
- json.addProperty("defaultOutputMode", defaultOutputMode().name());
- json.addProperty("defaultRecordingLayout", defaultRecordingLayout().name());
- json.addProperty("defaultCustomLayout", defaultCustomLayout());
json.addProperty("customSessionId", customSessionId());
+ json.add("defaultRecordingProperties", defaultRecordingProperties.toJson());
if (mediaNode() != null) {
JsonObject mediaNodeJson = new JsonObject();
mediaNodeJson.addProperty("id", mediaNode());
diff --git a/openvidu-node-client/src/Recording.ts b/openvidu-node-client/src/Recording.ts
index cc0989a6..f1fbc968 100644
--- a/openvidu-node-client/src/Recording.ts
+++ b/openvidu-node-client/src/Recording.ts
@@ -84,7 +84,7 @@ export class Recording {
};
if (this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.COMPOSED]
|| this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.COMPOSED_QUICK_START]) {
- this.properties.resolution = !!(json['resolution']) ? json['resolution'] : '1920x1080';
+ this.properties.resolution = !!(json['resolution']) ? json['resolution'] : '1280x720';
this.properties.recordingLayout = !!(json['recordingLayout']) ? json['recordingLayout'] : RecordingLayout.BEST_FIT;
if (this.properties.recordingLayout.toString() === RecordingLayout[RecordingLayout.CUSTOM]) {
this.properties.customLayout = json['customLayout'];
diff --git a/openvidu-node-client/src/RecordingLayout.ts b/openvidu-node-client/src/RecordingLayout.ts
index fb05b6d1..263df527 100644
--- a/openvidu-node-client/src/RecordingLayout.ts
+++ b/openvidu-node-client/src/RecordingLayout.ts
@@ -16,7 +16,7 @@
*/
/**
- * See [[SessionProperties.defaultRecordingLayout]] and [[RecordingProperties.recordingLayout]]
+ * See [[RecordingProperties.recordingLayout]]
*/
export enum RecordingLayout {
diff --git a/openvidu-node-client/src/RecordingProperties.ts b/openvidu-node-client/src/RecordingProperties.ts
index 3682c406..bb9334fc 100644
--- a/openvidu-node-client/src/RecordingProperties.ts
+++ b/openvidu-node-client/src/RecordingProperties.ts
@@ -32,45 +32,67 @@ export interface RecordingProperties {
/**
* The mode of recording: COMPOSED for a single archive in a grid layout or INDIVIDUAL for one archive for each stream
+ *
+ * Default to [[Recording.OutputMode.COMPOSED]]
*/
outputMode?: Recording.OutputMode;
/**
* The layout to be used in the recording.
* Will only have effect if [[RecordingProperties.outputMode]] is `COMPOSED` or `COMPOSED_QUICK_START`
+ *
+ * Default to [[RecordingLayout.BEST_FIT]]
*/
recordingLayout?: RecordingLayout;
/**
* 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`
- * See [Custom recording layouts](/en/stable/advanced-features/recording#custom-recording-layouts) to learn more
+ * 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",
* being both WIDTH and HEIGHT the number of pixels between 100 and 1999.
- * Will only have effect if [[RecordingProperties.outputMode]]
- * is set to [[Recording.OutputMode.COMPOSED]] or [[Recording.OutputMode.COMPOSED_QUICK_START]].
- * For [[Recording.OutputMode.INDIVIDUAL]] all
- * individual video files will have the native resolution 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 resolution of the published stream.
+ *
+ * Default to "1280x720"
*/
resolution?: string;
+ /**
+ * 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.
+ *
+ * Default to 25
+ */
+ 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;
/**
- * If COMPOSED recording, the amount of shared memory reserved for the recording process in bytes.
- * Minimum 134217728 (128MB). Property ignored if INDIVIDUAL recording. Default to 536870912 (512 MB)
+ * 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]]
+ * and [[RecordingProperties.hasVideo]] is set to true. Property ignored for INDIVIDUAL recordings and audio-only recordings.
+ * Minimum 134217728 (128MB).
+ *
+ * Default to 536870912 (512 MB)
*/
shmSize?: number;
diff --git a/openvidu-node-client/src/Session.ts b/openvidu-node-client/src/Session.ts
index 963efe41..c809bdcf 100644
--- a/openvidu-node-client/src/Session.ts
+++ b/openvidu-node-client/src/Session.ts
@@ -16,6 +16,7 @@
*/
import axios, { AxiosError } from 'axios';
+import { VideoCodec } from './VideoCodec';
import { Connection } from './Connection';
import { ConnectionProperties } from './ConnectionProperties';
import { MediaMode } from './MediaMode';
@@ -90,12 +91,7 @@ export class Session {
// Empty parameter
this.properties = {};
}
- this.properties.mediaMode = !!this.properties.mediaMode ? this.properties.mediaMode : MediaMode.ROUTED;
- this.properties.recordingMode = !!this.properties.recordingMode ? this.properties.recordingMode : RecordingMode.MANUAL;
- this.properties.defaultOutputMode = !!this.properties.defaultOutputMode ? this.properties.defaultOutputMode : Recording.OutputMode.COMPOSED;
- this.properties.defaultRecordingLayout = !!this.properties.defaultRecordingLayout ? this.properties.defaultRecordingLayout : RecordingLayout.BEST_FIT;
- this.properties.forcedVideoCodec = !!this.properties.forcedVideoCodec ? this.properties.forcedVideoCodec : undefined;
- this.properties.allowTranscoding = this.properties.allowTranscoding != null ? this.properties.allowTranscoding : undefined;
+ this.initDefaultSessionProperties();
}
/**
@@ -189,8 +185,8 @@ export class Session {
*
* @returns A Promise that is resolved if the session has been closed successfully and rejected with an Error object if not
*/
- public close(): Promise {
- return new Promise((resolve, reject) => {
+ public close(): Promise {
+ return new Promise((resolve, reject) => {
axios.delete(
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId,
{
@@ -272,8 +268,8 @@ export class Session {
*
* @returns A Promise that is resolved if the Connection was successfully removed from the Session and rejected with an Error object if not
*/
- public forceDisconnect(connection: string | Connection): Promise {
- return new Promise((resolve, reject) => {
+ public forceDisconnect(connection: string | Connection): Promise {
+ return new Promise((resolve, reject) => {
const connectionId: string = typeof connection === 'string' ? connection : (connection).connectionId;
axios.delete(
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId + '/connection/' + connectionId,
@@ -344,8 +340,8 @@ export class Session {
*
* @returns A Promise that is resolved if the stream was successfully unpublished and rejected with an Error object if not
*/
- public forceUnpublish(publisher: string | Publisher): Promise {
- return new Promise((resolve, reject) => {
+ public forceUnpublish(publisher: string | Publisher): Promise {
+ return new Promise((resolve, reject) => {
const streamId: string = typeof publisher === 'string' ? publisher : (publisher).streamId;
axios.delete(
this.ov.host + OpenVidu.API_SESSIONS + '/' + this.sessionId + '/stream/' + streamId,
@@ -466,20 +462,11 @@ export class Session {
resolve(this.sessionId);
}
- const mediaMode = !!this.properties.mediaMode ? this.properties.mediaMode : MediaMode.ROUTED;
- const recordingMode = !!this.properties.recordingMode ? this.properties.recordingMode : RecordingMode.MANUAL;
- const defaultOutputMode = !!this.properties.defaultOutputMode ? this.properties.defaultOutputMode : Recording.OutputMode.COMPOSED;
- const defaultRecordingLayout = !!this.properties.defaultRecordingLayout ? this.properties.defaultRecordingLayout : RecordingLayout.BEST_FIT;
- const defaultCustomLayout = !!this.properties.defaultCustomLayout ? this.properties.defaultCustomLayout : '';
- const customSessionId = !!this.properties.customSessionId ? this.properties.customSessionId : '';
- const mediaNode = !!this.properties.mediaNode ? this.properties.mediaNode : undefined;
- const forcedVideoCodec = !!this.properties.forcedVideoCodec ? this.properties.forcedVideoCodec : undefined;
- const allowTranscoding = this.properties.allowTranscoding != null ? this.properties.allowTranscoding : undefined;
+ this.initDefaultSessionProperties();
- const data = JSON.stringify({
- mediaMode, recordingMode, defaultOutputMode, defaultRecordingLayout, defaultCustomLayout,
- customSessionId, mediaNode, forcedVideoCodec, allowTranscoding
- });
+ const data = JSON.stringify(
+ this.properties
+ );
axios.post(
this.ov.host + OpenVidu.API_SESSIONS,
@@ -496,13 +483,11 @@ export class Session {
// SUCCESS response from openvidu-server. Resolve token
this.sessionId = res.data.id;
this.createdAt = res.data.createdAt;
- this.properties.mediaMode = mediaMode;
- this.properties.recordingMode = recordingMode;
- this.properties.defaultOutputMode = defaultOutputMode;
- this.properties.defaultRecordingLayout = defaultRecordingLayout;
- this.properties.defaultCustomLayout = defaultCustomLayout;
- this.properties.customSessionId = customSessionId;
- this.properties.mediaNode = mediaNode;
+ this.properties.mediaMode = res.data.mediaMode;
+ this.properties.recordingMode = res.data.recordingMode;
+ this.properties.defaultRecordingProperties = res.data.defaultRecordingProperties;
+ this.properties.customSessionId = res.data.customSessionId;
+ this.properties.mediaNode = res.data.mediaNode;
this.properties.forcedVideoCodec = res.data.forcedVideoCodec;
this.properties.allowTranscoding = res.data.allowTranscoding;
resolve(this.sessionId);
@@ -546,21 +531,17 @@ export class Session {
customSessionId: json.customSessionId,
mediaMode: json.mediaMode,
recordingMode: json.recordingMode,
- defaultOutputMode: json.defaultOutputMode,
- defaultRecordingLayout: json.defaultRecordingLayout,
- defaultCustomLayout: json.defaultCustomLayout,
+ defaultRecordingProperties: json.defaultRecordingProperties,
forcedVideoCodec: json.forcedVideoCodec,
allowTranscoding: json.allowTranscoding
};
- if (json.defaultRecordingLayout == null) {
- delete this.properties.defaultRecordingLayout;
+ this.initDefaultSessionProperties();
+ if (json.defaultRecordingProperties == null) {
+ delete this.properties.defaultRecordingProperties;
}
if (json.customSessionId == null) {
delete this.properties.customSessionId;
}
- if (json.defaultCustomLayout == null) {
- delete this.properties.defaultCustomLayout;
- }
if (json.mediaNode == null) {
delete this.properties.mediaNode;
}
@@ -668,4 +649,28 @@ export class Session {
}
}
+ /**
+ * @hidden
+ */
+ private initDefaultSessionProperties() {
+ this.properties.mediaMode = !!this.properties.mediaMode ? this.properties.mediaMode : MediaMode.ROUTED;
+ this.properties.recordingMode = !!this.properties.recordingMode ? this.properties.recordingMode : RecordingMode.MANUAL;
+ this.properties.defaultRecordingProperties = {
+ name: !!this.properties.defaultRecordingProperties?.name ? this.properties.defaultRecordingProperties?.name : '',
+ outputMode: !!this.properties.defaultRecordingProperties?.outputMode ? this.properties.defaultRecordingProperties?.outputMode : Recording.OutputMode.COMPOSED,
+ recordingLayout: !!this.properties.defaultRecordingProperties?.recordingLayout ? this.properties.defaultRecordingProperties?.recordingLayout : RecordingLayout.BEST_FIT,
+ customLayout: !!this.properties.defaultRecordingProperties?.customLayout ? this.properties.defaultRecordingProperties?.customLayout : '',
+ 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
+ };
+ this.properties.customSessionId = !!this.properties.customSessionId ? this.properties.customSessionId : '';
+ this.properties.mediaNode = !!this.properties.mediaNode ? this.properties.mediaNode : undefined;
+ this.properties.forcedVideoCodec = !!this.properties.forcedVideoCodec ? this.properties.forcedVideoCodec : VideoCodec.VP8;
+ this.properties.allowTranscoding = this.properties.allowTranscoding != null ? this.properties.allowTranscoding : false;
+ }
+
}
\ No newline at end of file
diff --git a/openvidu-node-client/src/SessionProperties.ts b/openvidu-node-client/src/SessionProperties.ts
index 4c718e10..da7b09b1 100644
--- a/openvidu-node-client/src/SessionProperties.ts
+++ b/openvidu-node-client/src/SessionProperties.ts
@@ -16,9 +16,9 @@
*/
import { MediaMode } from './MediaMode';
-import { Recording } from './Recording';
-import { RecordingLayout } from './RecordingLayout';
+import { RecordingProperties } from './RecordingProperties';
import { RecordingMode } from './RecordingMode';
+import { VideoCodec } from './VideoCodec';
/**
* See [[OpenVidu.createSession]]
@@ -28,35 +28,25 @@ export interface SessionProperties {
/**
* How the media streams will be sent and received by your clients: routed through OpenVidu Media Node
* (`MediaMode.ROUTED`) or attempting direct p2p connections (`MediaMode.RELAYED`, _not available yet_)
+ *
+ * Default to [[MediaMode.ROUTED]]
*/
mediaMode?: MediaMode;
/**
* Whether the Session will be automatically recorded (`RecordingMode.ALWAYS`) or not (`RecordingMode.MANUAL`)
+ *
+ * Default to [[RecordingMode.MANUAL]]
*/
recordingMode?: RecordingMode;
/**
- * Default value used to initialize property [[RecordingProperties.outputMode]] of every recording of this session.
- *
- * You can easily override this value later by setting [[RecordingProperties.outputMode]] to any other value
+ * Default recording properties of this session. You can easily override this value later when starting a
+ * [[Recording]] by providing new [[RecordingProperties]]
+ *
+ * Default values defined in [[RecordingProperties]] class
*/
- defaultOutputMode?: Recording.OutputMode;
-
- /**
- * Default value used to initialize property [[RecordingProperties.recordingLayout]] of every recording of this session.
- *
- * You can easily override this value later by setting [[RecordingProperties.recordingLayout]] to any other value
- */
- defaultRecordingLayout?: RecordingLayout;
-
- /**
- * Default value used to initialize property [[RecordingProperties.customLayout]] of every recording of this session.
- * This property can only be defined if [[SessionProperties.defaultRecordingLayout]] is set to [[RecordingLayout.CUSTOM]].
- *
- * You can easily override this value later by setting [[RecordingProperties.customLayout]] to any other value
- */
- defaultCustomLayout?: string;
+ defaultRecordingProperties?: RecordingProperties;
/**
* Fix the sessionId that will be assigned to the session with this parameter. You can take advantage of this property
@@ -79,16 +69,18 @@ export interface SessionProperties {
/**
* It defines which video codec do you want to be forcibly used for this session.
* This allows browsers/clients to use the same codec avoiding transcoding in the media server.
- * If the browser/client is not compatible with the specified codec and [[allowTranscoding]]
- * is false
and exception will occur.
- *
- * If forcedVideoCodec is set to NONE, no codec will be forced.
+ * If the browser/client is not compatible with the specified codec and [[allowTranscoding]] is false
+ * and exception will occur. If forcedVideoCodec is set to [[VideoCodec.NONE]], no codec will be forced.
+ *
+ * Default to [[VideoCodec.VP8]]
*/
- forcedVideoCodec?: string;
+ forcedVideoCodec?: VideoCodec;
/**
* It defines if you want to allow transcoding in the media server or not
* when [[forcedVideoCodec]] is not compatible with the browser/client.
+ *
+ * Default to false
*/
allowTranscoding?: boolean;