1
1
/**
2
2
* OpenTok Java SDK
3
- * Copyright (C) 2021 Vonage.
3
+ * Copyright (C) 2022 Vonage.
4
4
* http://www.tokbox.com
5
5
*
6
6
* Licensed under The MIT License (MIT). See LICENSE file for more information.
7
7
*/
8
8
package com .opentok ;
9
9
10
10
import com .opentok .Archive .OutputMode ;
11
+ import com .opentok .Archive .StreamMode ;
11
12
12
13
import java .util .ArrayList ;
13
14
import java .util .Collection ;
17
18
18
19
/**
19
20
* Defines values for the <code>properties</code> parameter of the
20
- * {@link OpenTok#createSession(SessionProperties )} method.
21
+ * {@link OpenTok#startArchive(String sessionId, ArchiveProperties properties )} method.
21
22
*
22
23
* @see OpenTok#createSession(com.opentok.SessionProperties properties)
23
24
*/
@@ -29,6 +30,7 @@ public class ArchiveProperties {
29
30
private boolean hasAudio ;
30
31
private boolean hasVideo ;
31
32
private OutputMode outputMode ;
33
+ private StreamMode streamMode ;
32
34
private ArchiveLayout layout ;
33
35
34
36
private ArchiveProperties (Builder builder ) {
@@ -37,11 +39,12 @@ private ArchiveProperties(Builder builder) {
37
39
this .hasAudio = builder .hasAudio ;
38
40
this .hasVideo = builder .hasVideo ;
39
41
this .outputMode = builder .outputMode ;
42
+ this .streamMode = builder .streamMode ;
40
43
this .layout = builder .layout ;
41
44
}
42
45
43
46
/**
44
- * Use this class to create a ArchiveProperties object.
47
+ * Used to create an ArchiveProperties object.
45
48
*
46
49
* @see ArchiveProperties
47
50
*/
@@ -51,11 +54,11 @@ public static class Builder {
51
54
private boolean hasAudio = true ;
52
55
private boolean hasVideo = true ;
53
56
private OutputMode outputMode = OutputMode .COMPOSED ;
57
+ private StreamMode streamMode = StreamMode .AUTO ;
54
58
private ArchiveLayout layout = null ;
55
-
56
59
57
60
/**
58
- * Call this method to set a name to the archive.
61
+ * Sets a name for the archive.
59
62
*
60
63
* @param name The name of the archive. You can use this name to identify the archive. It is a property
61
64
* of the Archive object, and it is a property of archive-related events in the OpenTok JavaScript SDK.
@@ -68,7 +71,7 @@ public Builder name(String name) {
68
71
}
69
72
70
73
/**
71
- * Call this method to set the resolution of the archive.
74
+ * Sets the resolution of the archive.
72
75
*
73
76
* @param resolution The resolution of the archive, either "640x480" (SD, the default) or
74
77
* "1280x720" (HD). This property only applies to composed archives. If you set this
@@ -83,7 +86,8 @@ public Builder resolution(String resolution) {
83
86
}
84
87
85
88
/**
86
- * Call this method to include an audio track (<code>true</code>) or not <code>false</code>).
89
+ * Call this method to include an audio track (<code>true</code>, the default)
90
+ * or not <code>false</code>).
87
91
*
88
92
* @param hasAudio Whether the archive will include an audio track.
89
93
*
@@ -93,21 +97,22 @@ public Builder hasAudio(boolean hasAudio) {
93
97
this .hasAudio = hasAudio ;
94
98
return this ;
95
99
}
96
-
100
+
97
101
/**
98
- * Call this method to include an video track (<code>true</code>) or not <code>false</code>).
102
+ * Call this method to include an video track (<code>true</code>, the default)
103
+ * or not <code>false</code>).
99
104
*
100
- * @param hasVideo Whether the archive will include an video track.
105
+ * @param hasVideo Whether the archive will include a video track.
101
106
*
102
107
* @return The ArchiveProperties.Builder object with the hasVideo setting.
103
108
*/
104
109
public Builder hasVideo (boolean hasVideo ) {
105
110
this .hasVideo = hasVideo ;
106
111
return this ;
107
- }
112
+ }
108
113
109
114
/**
110
- * Call this method to choose the output mode to be generated for this archive.
115
+ * Sets the output mode for this archive.
111
116
*
112
117
* @param outputMode Set to a value defined in the {@link Archive.OutputMode} enum.
113
118
*
@@ -119,13 +124,36 @@ public Builder outputMode(OutputMode outputMode) {
119
124
}
120
125
121
126
/**
122
- * Call this method to customize the layout for a composed archive
127
+ * Sets the stream mode for this archive.
128
+ *
129
+ * When streams are selected automatically (<code>StreamMode.AUTO</code>, the default), all
130
+ * streams in the session can be included in the archive. When streams are selected manually
131
+ * (<code>StreamMode.MANUAL</code>), you specify streams to be included based on calls
132
+ * to the {@link OpenTok#addArchiveStream(String, String, boolean, boolean)} and
133
+ * {@link OpenTok#removeArchiveStream(String, String)} methods. With
134
+ * <code>StreamMode.MANUAL</code>, you can specify whether a stream's audio, video, or both
135
+ * are included in the archive. Un both automatic and manual modes, the archive composer
136
+ * includes streams based on
137
+ * <a href="https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules">stream
138
+ * prioritization rules</a>.
139
+ *
140
+ * @param streamMode Set to a value defined in the {@link Archive.StreamMode} enum.
141
+ *
142
+ * @return The ArchiveProperties.Builder object with the stream mode setting.
143
+ */
144
+ public Builder streamMode (StreamMode streamMode ) {
145
+ this .streamMode = streamMode ;
146
+ return this ;
147
+ }
148
+
149
+ /**
150
+ * Sets the layout for a composed archive.
123
151
*
124
152
* @param layout An object of type {@link ArchiveLayout} .
125
153
*
126
154
* @return The ArchiveProperties.Builder object with the output mode setting.
127
155
*/
128
- public Builder layout (ArchiveLayout layout ){
156
+ public Builder layout (ArchiveLayout layout ) {
129
157
this .layout = layout ;
130
158
return this ;
131
159
}
@@ -139,18 +167,21 @@ public ArchiveProperties build() {
139
167
return new ArchiveProperties (this );
140
168
}
141
169
}
170
+
142
171
/**
143
- * Returns the name of the archive, which you can use to identify the archive
172
+ * Returns the name of the archive, which you can use to identify the archive.
144
173
*/
145
174
public String name () {
146
175
return name ;
147
176
}
177
+
148
178
/**
149
- * Returns the resolution of the archive
179
+ * Returns the resolution of the archive.
150
180
*/
151
181
public String resolution () {
152
182
return resolution ;
153
183
}
184
+
154
185
/**
155
186
* Whether the archive has a video track (<code>true</code>) or not (<code>false</code>).
156
187
*/
@@ -164,7 +195,7 @@ public boolean hasVideo() {
164
195
public boolean hasAudio () {
165
196
return hasAudio ;
166
197
}
167
-
198
+
168
199
/**
169
200
* The output mode of the archive.
170
201
*/
@@ -173,7 +204,12 @@ public OutputMode outputMode() {
173
204
}
174
205
175
206
/**
176
- * Optionally set a custom layout (composed archives only)
207
+ * The stream mode of the archive.
208
+ */
209
+ public StreamMode streamMode () { return streamMode ; }
210
+
211
+ /**
212
+ * Returns the custom layout of the archive (composed archives only).
177
213
*/
178
214
public ArchiveLayout layout () {
179
215
return layout ;
@@ -197,15 +233,19 @@ public Map<String, Collection<String>> toMap() {
197
233
ArrayList <String > valueList = new ArrayList <String >();
198
234
valueList .add (Boolean .toString (hasAudio ));
199
235
params .put ("hasAudio" , valueList );
200
-
236
+
201
237
valueList = new ArrayList <String >();
202
238
valueList .add (Boolean .toString (hasVideo ));
203
239
params .put ("hasVideo" , valueList );
204
-
240
+
205
241
valueList = new ArrayList <String >();
206
242
valueList .add (outputMode .toString ());
207
243
params .put ("outputMode" , valueList );
208
244
245
+ valueList = new ArrayList <String >();
246
+ valueList .add (streamMode .toString ());
247
+ params .put ("streamMode" , valueList );
248
+
209
249
if (layout != null ) {
210
250
valueList = new ArrayList <String >();
211
251
valueList .add (layout .toString ());
0 commit comments