openvidu server clients: defaultOutputMode added to SessionProperties

pull/203/head
pabloFuente 2019-01-29 12:27:27 +01:00
parent c66bfc3ea5
commit ab4eb7cf6d
4 changed files with 102 additions and 40 deletions

View File

@ -50,7 +50,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() {
this.resolution = (this.resolution == null) ? (OutputMode.COMPOSED.equals(this.outputMode) ? "1920x1080" : null) : this.resolution; this.resolution = (this.resolution == null)
? (OutputMode.COMPOSED.equals(this.outputMode) ? "1920x1080" : null)
: this.resolution;
return new RecordingProperties(this.name, this.outputMode, this.recordingLayout, this.customLayout, return new RecordingProperties(this.name, this.outputMode, this.recordingLayout, this.customLayout,
this.resolution, this.hasAudio, this.hasVideo); this.resolution, this.hasAudio, this.hasVideo);
} }
@ -121,7 +123,7 @@ public class RecordingProperties {
} }
/** /**
* Call this method to specify whether or not to record the audio track * Call this method to specify whether to record audio or not. Cannot be set to false at the same time as {@link hasVideo(boolean)}
*/ */
public RecordingProperties.Builder hasAudio(boolean hasAudio) { public RecordingProperties.Builder hasAudio(boolean hasAudio) {
this.hasAudio = hasAudio; this.hasAudio = hasAudio;
@ -129,7 +131,7 @@ public class RecordingProperties {
} }
/** /**
* Call this method to specify whether or not to record the video track * Call this method to specify whether to record video or not. Cannot be set to false at the same time as {@link hasAudio(boolean)}
*/ */
public RecordingProperties.Builder hasVideo(boolean hasVideo) { public RecordingProperties.Builder hasVideo(boolean hasVideo) {
this.hasVideo = hasVideo; this.hasVideo = hasVideo;
@ -159,15 +161,20 @@ public class RecordingProperties {
} }
/** /**
* Defines the mode of recording: COMPOSED for a single archive in a grid layout * Defines the mode of recording: {@link Recording.OutputMode#COMPOSED} for a
* or INDIVIDUAL for one archive for each stream * single archive in a grid layout or {@link Recording.OutputMode#INDIVIDUAL}
* for one archive for each stream
*/ */
public Recording.OutputMode outputMode() { public Recording.OutputMode outputMode() {
return this.outputMode; return this.outputMode;
} }
/** /**
* Defines the layout to be used in the recording * Defines the layout to be used in the recording.<br>
* 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}
*/ */
public RecordingLayout recordingLayout() { public RecordingLayout recordingLayout() {
return this.recordingLayout; return this.recordingLayout;
@ -176,8 +183,8 @@ public class RecordingProperties {
/** /**
* If {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} is * If {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} is
* set to {@link io.openvidu.java.client.RecordingLayout#CUSTOM}, this property * set to {@link io.openvidu.java.client.RecordingLayout#CUSTOM}, this property
* defines the relative path to the specific custom layout you want to use. See * defines the relative path to the specific custom layout you want to use.<br>
* <a href= * See <a href=
* "https://openvidu.io/docs/advanced-features/recording#custom-recording-layouts" * "https://openvidu.io/docs/advanced-features/recording#custom-recording-layouts"
* target="_blank">Custom recording layouts</a> to learn more * target="_blank">Custom recording layouts</a> to learn more
*/ */
@ -186,21 +193,28 @@ public class RecordingProperties {
} }
/** /**
* Defines the resolution of the recorded video * Defines the resolution of the recorded video.<br>
* 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}. For
* {@link io.openvidu.java.client.Recording.OutputMode#INDIVIDUAL} all
* individual video files will have the native resolution of the published
* stream
*/ */
public String resolution() { public String resolution() {
return this.resolution; return this.resolution;
} }
/** /**
* Defines if the recording has an audio track or not * Defines whether to record audio or not. Cannot be set to false at the same time as {@link hasVideo()}
*/ */
public boolean hasAudio() { public boolean hasAudio() {
return this.hasAudio; return this.hasAudio;
} }
/** /**
* Defines if the recording has a video track or not * Defines whether to record video or not. Cannot be set to false at the same time as {@link hasAudio()}
*/ */
public boolean hasVideo() { public boolean hasVideo() {
return this.hasVideo; return this.hasVideo;

View File

@ -17,6 +17,8 @@
package io.openvidu.java.client; package io.openvidu.java.client;
import io.openvidu.java.client.Recording.OutputMode;
/** /**
* See {@link io.openvidu.java.client.OpenVidu#createSession(SessionProperties)} * See {@link io.openvidu.java.client.OpenVidu#createSession(SessionProperties)}
*/ */
@ -24,6 +26,7 @@ public class SessionProperties {
private MediaMode mediaMode; private MediaMode mediaMode;
private RecordingMode recordingMode; private RecordingMode recordingMode;
private OutputMode defaultOutputMode;
private RecordingLayout defaultRecordingLayout; private RecordingLayout defaultRecordingLayout;
private String defaultCustomLayout; private String defaultCustomLayout;
private String customSessionId; private String customSessionId;
@ -35,6 +38,7 @@ public class SessionProperties {
private MediaMode mediaMode = MediaMode.ROUTED; private MediaMode mediaMode = MediaMode.ROUTED;
private RecordingMode recordingMode = RecordingMode.MANUAL; private RecordingMode recordingMode = RecordingMode.MANUAL;
private OutputMode defaultOutputMode = OutputMode.COMPOSED;
private RecordingLayout defaultRecordingLayout = RecordingLayout.BEST_FIT; private RecordingLayout defaultRecordingLayout = RecordingLayout.BEST_FIT;
private String defaultCustomLayout = ""; private String defaultCustomLayout = "";
private String customSessionId = ""; private String customSessionId = "";
@ -44,8 +48,8 @@ public class SessionProperties {
* configured * configured
*/ */
public SessionProperties build() { public SessionProperties build() {
return new SessionProperties(this.mediaMode, this.recordingMode, this.defaultRecordingLayout, return new SessionProperties(this.mediaMode, this.recordingMode, this.defaultOutputMode,
this.defaultCustomLayout, this.customSessionId); this.defaultRecordingLayout, this.defaultCustomLayout, this.customSessionId);
} }
/** /**
@ -63,25 +67,39 @@ public class SessionProperties {
/** /**
* Call this method to set whether the Session will be automatically recorded * Call this method to set whether the Session will be automatically recorded
* (<code>RecordingMode.ALWAYS</code>) or not * ({@link RecordingMode#ALWAYS}) or not ({@link RecordingMode#MANUAL})<br>
* (<code>RecordingMode.MANUAL</code>) * Default value is {@link RecordingMode#MANUAL}
*
* Default value is <code>RecordingMode.MANUAL</code>
*/ */
public SessionProperties.Builder recordingMode(RecordingMode recordingMode) { public SessionProperties.Builder recordingMode(RecordingMode recordingMode) {
this.recordingMode = recordingMode; this.recordingMode = recordingMode;
return this; return this;
} }
/**
* 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.<br>
* Default value is {@link Recording.OutputMode#COMPOSED}
*/
public SessionProperties.Builder defaultOutputMode(OutputMode outputMode) {
this.defaultOutputMode = outputMode;
return this;
}
/** /**
* Call this method to set the the default value used to initialize property * Call this method to set the the default value used to initialize property
* {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} of * {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} of
* every recording of this session. You can easily override this value later * every recording of this session. You can easily override this value later
* when initializing a {@link io.openvidu.java.client.Recording} by calling * when starting a {@link io.openvidu.java.client.Recording} by calling
* {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)} * {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)}
* with any other value * with any other value.<br>
* * Default value is {@link RecordingLayout#BEST_FIT}<br>
* Default value is <code>RecordingLayout.BEST_FIT</code> * <br>
* Recording layouts are only applicable to recordings with OutputMode
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED}
*/ */
public SessionProperties.Builder defaultRecordingLayout(RecordingLayout layout) { public SessionProperties.Builder defaultRecordingLayout(RecordingLayout layout) {
this.defaultRecordingLayout = layout; this.defaultRecordingLayout = layout;
@ -92,9 +110,13 @@ public class SessionProperties {
* Call this method to set the default value used to initialize property * Call this method to set the default value used to initialize property
* {@link io.openvidu.java.client.RecordingProperties#customLayout()} of every * {@link io.openvidu.java.client.RecordingProperties#customLayout()} of every
* recording of this session. You can easily override this value later when * recording of this session. You can easily override this value later when
* initializing a {@link io.openvidu.java.client.Recording} by calling * starting a {@link io.openvidu.java.client.Recording} by calling
* {@link io.openvidu.java.client.RecordingProperties.Builder#customLayout(String)} * {@link io.openvidu.java.client.RecordingProperties.Builder#customLayout(String)}
* with any other value * with any other value.<br><br>
*
* Custom layouts are only applicable to recordings with OutputMode
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} and
* RecordingLayout {@link io.openvidu.java.client.RecordingLayout#CUSTOM}
*/ */
public SessionProperties.Builder defaultCustomLayout(String path) { public SessionProperties.Builder defaultCustomLayout(String path) {
this.defaultCustomLayout = path; this.defaultCustomLayout = path;
@ -118,29 +140,22 @@ public class SessionProperties {
protected SessionProperties() { protected SessionProperties() {
this.mediaMode = MediaMode.ROUTED; this.mediaMode = MediaMode.ROUTED;
this.recordingMode = RecordingMode.MANUAL; this.recordingMode = RecordingMode.MANUAL;
this.defaultOutputMode = OutputMode.COMPOSED;
this.defaultRecordingLayout = RecordingLayout.BEST_FIT; this.defaultRecordingLayout = RecordingLayout.BEST_FIT;
this.defaultCustomLayout = ""; this.defaultCustomLayout = "";
this.customSessionId = ""; this.customSessionId = "";
} }
private SessionProperties(MediaMode mediaMode, RecordingMode recordingMode, RecordingLayout layout, private SessionProperties(MediaMode mediaMode, RecordingMode recordingMode, OutputMode outputMode,
String defaultCustomLayout, String customSessionId) { RecordingLayout layout, String defaultCustomLayout, String customSessionId) {
this.mediaMode = mediaMode; this.mediaMode = mediaMode;
this.recordingMode = recordingMode; this.recordingMode = recordingMode;
this.defaultOutputMode = outputMode;
this.defaultRecordingLayout = layout; this.defaultRecordingLayout = layout;
this.defaultCustomLayout = defaultCustomLayout; this.defaultCustomLayout = defaultCustomLayout;
this.customSessionId = customSessionId; this.customSessionId = customSessionId;
} }
/**
* Defines whether the Session will be automatically recorded
* (<code>RecordingMode.ALWAYS</code>) or not
* (<code>RecordingMode.MANUAL</code>)
*/
public RecordingMode recordingMode() {
return this.recordingMode;
}
/** /**
* Defines how the media streams will be sent and received by your clients: * Defines how the media streams will be sent and received by your clients:
* routed through OpenVidu Media Server (<code>MediaMode.ROUTED</code>) or * routed through OpenVidu Media Server (<code>MediaMode.ROUTED</code>) or
@ -151,13 +166,35 @@ public class SessionProperties {
return this.mediaMode; return this.mediaMode;
} }
/**
* Defines whether the Session will be automatically recorded
* ({@link RecordingMode#ALWAYS}) or not ({@link RecordingMode#MANUAL})
*/
public RecordingMode recordingMode() {
return this.recordingMode;
}
/**
* 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
*/
public OutputMode defaultOutputMode() {
return this.defaultOutputMode;
}
/** /**
* Defines the default value used to initialize property * Defines the default value used to initialize property
* {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} of * {@link io.openvidu.java.client.RecordingProperties#recordingLayout()} of
* every recording of this session. You can easily override this value later * every recording of this session. You can easily override this value later
* when initializing a {@link io.openvidu.java.client.Recording} by calling * when starting a {@link io.openvidu.java.client.Recording} by calling
* {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)} * {@link io.openvidu.java.client.RecordingProperties.Builder#recordingLayout(RecordingLayout)}
* with any other value * with any other value.<br>
* Recording layouts are only applicable to recordings with OutputMode
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED}
*/ */
public RecordingLayout defaultRecordingLayout() { public RecordingLayout defaultRecordingLayout() {
return this.defaultRecordingLayout; return this.defaultRecordingLayout;
@ -167,9 +204,12 @@ public class SessionProperties {
* Defines the default value used to initialize property * Defines the default value used to initialize property
* {@link io.openvidu.java.client.RecordingProperties#customLayout()} of every * {@link io.openvidu.java.client.RecordingProperties#customLayout()} of every
* recording of this session. You can easily override this value later when * recording of this session. You can easily override this value later when
* initializing a {@link io.openvidu.java.client.Recording} by calling * starting a {@link io.openvidu.java.client.Recording} by calling
* {@link io.openvidu.java.client.RecordingProperties.Builder#customLayout(String)} * {@link io.openvidu.java.client.RecordingProperties.Builder#customLayout(String)}
* with any other value * with any other value.<br>
* Custom layouts are only applicable to recordings with OutputMode
* {@link io.openvidu.java.client.Recording.OutputMode#COMPOSED} and
* RecordingLayout {@link io.openvidu.java.client.RecordingLayout#CUSTOM}
*/ */
public String defaultCustomLayout() { public String defaultCustomLayout() {
return this.defaultCustomLayout; return this.defaultCustomLayout;

View File

@ -57,12 +57,12 @@ export interface RecordingProperties {
resolution?: string; resolution?: string;
/** /**
* Whether or not to record the audio track (currently fixed to true) * Whether or not to record audio. Cannot be set to false at the same time as [[RecordingProperties.hasVideo]]
*/ */
hasAudio?: boolean; hasAudio?: boolean;
/** /**
* Whether or not to record the video track (currently fixed to true) * Whether or not to record video. Cannot be set to false at the same time as [[RecordingProperties.hasAudio]]
*/ */
hasVideo?: boolean; hasVideo?: boolean;
} }

View File

@ -16,6 +16,7 @@
*/ */
import { MediaMode } from './MediaMode'; import { MediaMode } from './MediaMode';
import { Recording } from './Recording';
import { RecordingLayout } from './RecordingLayout'; import { RecordingLayout } from './RecordingLayout';
import { RecordingMode } from './RecordingMode'; import { RecordingMode } from './RecordingMode';
@ -35,6 +36,13 @@ export interface SessionProperties {
*/ */
recordingMode?: RecordingMode; 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
*/
defaultOutputMode?: Recording.OutputMode;
/** /**
* Default value used to initialize property [[RecordingProperties.recordingLayout]] of every recording of this session. * Default value used to initialize property [[RecordingProperties.recordingLayout]] of every recording of this session.
* *