Skip to content

Commit 34d42fa

Browse files
author
Mofizur Rahman
authored
Merge pull request #212 from opentok/dev
v4.6.0
2 parents 2ff0953 + 70567d1 commit 34d42fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1277
-374
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[bumpversion]
22
commit = True
33
tag = True
4-
current_version = 4.5.0
4+
current_version = 4.6.0
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
66
serialize =
77
{major}.{minor}.{patch}

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55

66
<img src="https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg" height="48px" alt="Tokbox is now known as Vonage" />
77

8-
The OpenTok Java SDK lets you generate
9-
[sessions](https://tokbox.com/developer/guides/create-session/) and
10-
[tokens](https://tokbox.com/developer/guides/create-token/) for
11-
[OpenTok](http://www.tokbox.com/) applications that run on the JVM. It also includes methods for
12-
working with OpenTok [archives](https://tokbox.com/developer/guides/archiving),
13-
working with OpenTok [live streaming
14-
broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/),
15-
working with OpenTok [SIP interconnect](https://tokbox.com/developer/guides/sip),
16-
[signaling OpenTok sessions from the server](https://tokbox.com/developer/guides/signaling/),
17-
and [disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/).
8+
The OpenTok Java SDK provides methods for:
9+
10+
* Generating [sessions](https://tokbox.com/developer/guides/create-session/) and
11+
[tokens](https://tokbox.com/developer/guides/create-token/) for
12+
[OpenTok](https://www.vonage.com/communications-apis/video/) applications
13+
* Working with OpenTok [archives](https://tokbox.com/developer/guides/archiving)
14+
* Working with OpenTok [live streaming broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/)
15+
* Working with OpenTok [SIP interconnect](https://tokbox.com/developer/guides/sip)
16+
* [Sending signals to clients connected to a session](https://tokbox.com/developer/guides/signaling/)
17+
* [Disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/)
18+
* [Forcing clients in a session to disconnect or mute published audio](https://tokbox.com/developer/guides/moderation/)
1819

1920
## Installation
2021

@@ -366,6 +367,19 @@ The `connectionId` parameter is used to specify the connection ID of a client co
366367

367368
For more information on the force disconnect functionality and exception codes, please see the [REST API documentation](https://tokbox.com/developer/rest/#forceDisconnect).
368369

370+
### Forcing clients in a session to mute published audio
371+
372+
You can force the publisher of a specific stream to stop publishing audio using the
373+
`Opentok.forceMuteStream(String sessionId, String streamId)`method.
374+
375+
You can force the publisher of all streams in a session (except for an optional list of streams)
376+
to stop publishing audio using the `Opentok.forceMuteAll(String sessionId, MuteAllProperties properties)`
377+
method. You can then disable the mute state of the session by calling the
378+
`Opentok.disableForceMute(String sessionId)` method.
379+
380+
For more information, see
381+
[Muting the audio of streams in a session](https://tokbox.com/developer/guides/moderation/#force_mute).
382+
369383
### Signaling
370384

371385
You can send signals to all the connections in a session or to a specific connection:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ apply plugin: 'jacoco'
1212

1313
group = 'com.tokbox'
1414
archivesBaseName = 'opentok-server-sdk'
15-
version = '4.5.0'
15+
version = '4.6.0'
1616

1717
task javadocJar(type: Jar) {
1818
classifier = 'javadoc'

src/main/java/com/opentok/Archive.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2021 Vonage.
3+
* Copyright (C) 2022 Vonage.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.
@@ -88,6 +88,26 @@ public enum OutputMode {
8888
}
8989
}
9090

91+
/**
92+
* Defines values used in the
93+
* {@link ArchiveProperties.Builder#streamMode(com.opentok.Archive.StreamMode)} method
94+
* and returned by the {@link Archive#getStreamMode()} method.
95+
*/
96+
public enum StreamMode {
97+
/**
98+
* Streams will be automatically included in the archive.
99+
*/
100+
AUTO,
101+
/**
102+
* Streams will be included in the archive based on calls to the
103+
* {@link OpenTok#addArchiveStream(String, String, boolean, boolean)} and
104+
* {@link OpenTok#removeArchiveStream(String, String)} methods.
105+
*/
106+
MANUAL;
107+
108+
@JsonValue public String toString() { return super.toString().toLowerCase(); }
109+
}
110+
91111
@JsonProperty private long createdAt;
92112
@JsonProperty private int duration = 0;
93113
@JsonProperty private String id;
@@ -101,6 +121,7 @@ public enum OutputMode {
101121
@JsonProperty private boolean hasVideo = true;
102122
@JsonProperty private boolean hasAudio = true;
103123
@JsonProperty private OutputMode outputMode = OutputMode.COMPOSED;
124+
@JsonProperty private StreamMode streamMode = StreamMode.AUTO;
104125
@JsonProperty private String password;
105126
@JsonProperty private String resolution;
106127

@@ -215,6 +236,14 @@ public boolean hasAudio() {
215236
public OutputMode getOutputMode() {
216237
return outputMode;
217238
}
239+
240+
/**
241+
* The stream mode to used for selecting streams to be included in this archive:
242+
* <code>StreamMode.AUTO</code> or <code>StreamMode.MANUAL</code>.
243+
*/
244+
public StreamMode getStreamMode() {
245+
return streamMode;
246+
}
218247

219248
/**
220249
* The encrypted password if an archive storage was configured to use an encryption key

src/main/java/com/opentok/ArchiveLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2021 Vonage.
3+
* Copyright (C) 2022 Vonage.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/ArchiveList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2021 Vonage.
3+
* Copyright (C) 2022 Vonage.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.

src/main/java/com/opentok/ArchiveMode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2021 Vonage.
3+
* Copyright (C) 2022 Vonage.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.
@@ -20,7 +20,7 @@ public enum ArchiveMode {
2020
MANUAL ("manual"),
2121

2222
/**
23-
* The session is archived automatically (as soon as there are clients publishing streams
23+
* The session is archived automatically (as soon as there are clients connected
2424
* to the session).
2525
*/
2626
ALWAYS ("always");

src/main/java/com/opentok/ArchiveProperties.java

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/**
22
* OpenTok Java SDK
3-
* Copyright (C) 2021 Vonage.
3+
* Copyright (C) 2022 Vonage.
44
* http://www.tokbox.com
55
*
66
* Licensed under The MIT License (MIT). See LICENSE file for more information.
77
*/
88
package com.opentok;
99

1010
import com.opentok.Archive.OutputMode;
11+
import com.opentok.Archive.StreamMode;
1112

1213
import java.util.ArrayList;
1314
import java.util.Collection;
@@ -17,7 +18,7 @@
1718

1819
/**
1920
* 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.
2122
*
2223
* @see OpenTok#createSession(com.opentok.SessionProperties properties)
2324
*/
@@ -29,6 +30,7 @@ public class ArchiveProperties {
2930
private boolean hasAudio;
3031
private boolean hasVideo;
3132
private OutputMode outputMode;
33+
private StreamMode streamMode;
3234
private ArchiveLayout layout;
3335

3436
private ArchiveProperties(Builder builder) {
@@ -37,11 +39,12 @@ private ArchiveProperties(Builder builder) {
3739
this.hasAudio = builder.hasAudio;
3840
this.hasVideo = builder.hasVideo;
3941
this.outputMode = builder.outputMode;
42+
this.streamMode = builder.streamMode;
4043
this.layout = builder.layout;
4144
}
4245

4346
/**
44-
* Use this class to create a ArchiveProperties object.
47+
* Used to create an ArchiveProperties object.
4548
*
4649
* @see ArchiveProperties
4750
*/
@@ -51,11 +54,11 @@ public static class Builder {
5154
private boolean hasAudio = true;
5255
private boolean hasVideo = true;
5356
private OutputMode outputMode = OutputMode.COMPOSED;
57+
private StreamMode streamMode = StreamMode.AUTO;
5458
private ArchiveLayout layout = null;
55-
5659

5760
/**
58-
* Call this method to set a name to the archive.
61+
* Sets a name for the archive.
5962
*
6063
* @param name The name of the archive. You can use this name to identify the archive. It is a property
6164
* 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) {
6871
}
6972

7073
/**
71-
* Call this method to set the resolution of the archive.
74+
* Sets the resolution of the archive.
7275
*
7376
* @param resolution The resolution of the archive, either "640x480" (SD, the default) or
7477
* "1280x720" (HD). This property only applies to composed archives. If you set this
@@ -83,7 +86,8 @@ public Builder resolution(String resolution) {
8386
}
8487

8588
/**
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>).
8791
*
8892
* @param hasAudio Whether the archive will include an audio track.
8993
*
@@ -93,21 +97,22 @@ public Builder hasAudio(boolean hasAudio) {
9397
this.hasAudio = hasAudio;
9498
return this;
9599
}
96-
100+
97101
/**
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>).
99104
*
100-
* @param hasVideo Whether the archive will include an video track.
105+
* @param hasVideo Whether the archive will include a video track.
101106
*
102107
* @return The ArchiveProperties.Builder object with the hasVideo setting.
103108
*/
104109
public Builder hasVideo(boolean hasVideo) {
105110
this.hasVideo = hasVideo;
106111
return this;
107-
}
112+
}
108113

109114
/**
110-
* Call this method to choose the output mode to be generated for this archive.
115+
* Sets the output mode for this archive.
111116
*
112117
* @param outputMode Set to a value defined in the {@link Archive.OutputMode} enum.
113118
*
@@ -119,13 +124,36 @@ public Builder outputMode(OutputMode outputMode) {
119124
}
120125

121126
/**
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.
123151
*
124152
* @param layout An object of type {@link ArchiveLayout} .
125153
*
126154
* @return The ArchiveProperties.Builder object with the output mode setting.
127155
*/
128-
public Builder layout(ArchiveLayout layout){
156+
public Builder layout(ArchiveLayout layout) {
129157
this.layout = layout;
130158
return this;
131159
}
@@ -139,18 +167,21 @@ public ArchiveProperties build() {
139167
return new ArchiveProperties(this);
140168
}
141169
}
170+
142171
/**
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.
144173
*/
145174
public String name() {
146175
return name;
147176
}
177+
148178
/**
149-
* Returns the resolution of the archive
179+
* Returns the resolution of the archive.
150180
*/
151181
public String resolution() {
152182
return resolution;
153183
}
184+
154185
/**
155186
* Whether the archive has a video track (<code>true</code>) or not (<code>false</code>).
156187
*/
@@ -164,7 +195,7 @@ public boolean hasVideo() {
164195
public boolean hasAudio() {
165196
return hasAudio;
166197
}
167-
198+
168199
/**
169200
* The output mode of the archive.
170201
*/
@@ -173,7 +204,12 @@ public OutputMode outputMode() {
173204
}
174205

175206
/**
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).
177213
*/
178214
public ArchiveLayout layout() {
179215
return layout;
@@ -197,15 +233,19 @@ public Map<String, Collection<String>> toMap() {
197233
ArrayList<String> valueList = new ArrayList<String>();
198234
valueList.add(Boolean.toString(hasAudio));
199235
params.put("hasAudio", valueList);
200-
236+
201237
valueList = new ArrayList<String>();
202238
valueList.add(Boolean.toString(hasVideo));
203239
params.put("hasVideo", valueList);
204-
240+
205241
valueList = new ArrayList<String>();
206242
valueList.add(outputMode.toString());
207243
params.put("outputMode", valueList);
208244

245+
valueList = new ArrayList<String>();
246+
valueList.add(streamMode.toString());
247+
params.put("streamMode", valueList);
248+
209249
if (layout != null) {
210250
valueList = new ArrayList<String>();
211251
valueList.add(layout.toString());

0 commit comments

Comments
 (0)