Skip to content

Commit 74abd63

Browse files
SMadanijeffswartz
andauthored
v4.9.0 Release (#235)
* Minor fixes in build.gradle * Added support for MultiBroadcastTag and MultiArchiveTag (#226) * Added multiArchiveTag * Added multiBroadcastTag * Updated docs * Removed getMulti*Tag from responses * Revert "Removed getMulti*Tag from responses" This reverts commit 6e7f123. * Docs edits re multiArchive/BroadcastTag. Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com> * Add Experience Composer API (#227) * Added startRender * Added listRenders * Deserialize listRenders response to native List * Added stopRender & getRender * Use enum for Render status * Improved RenderProperties * Experience composer docs edits ... And other docs corrections Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com> * Bump dependency versions * Improved release process. bump2version is now manual, but release to Nexus is fully automated. * Ensure version is passed in bumpversion.sh * Bumped dependencies (including WireMock) * Bump version: v4.8.0 → v4.8.1 * Update copyright year * Use wiremock-jre8 * Boost coverage * Boost coverage * Disable codecov temporarily * Revert "Disable codecov temporarily" This reverts commit 613bff0. * Add Audio Streamer (lite) API endpoint (#215) * Added Audio Streamer (lite) endpoint * Don't include headers or streams if empty in connect request * Renamed Connect for clarity * Addressed PR comments * Fixed failing test * URI in AudioStreamerConnectionProperties constructor * Docs edits * Bumped dependencies (notably WireMock to 2.x) * Bumped dependencies * Bump dependency versions (#233) Improved release process, bumped dependency versions (including WireMock), slightly improved test coverage, updated copyright year, merged main, ready for release v4.8.1. * Renamed to Audio Connector * Bumped dependencies * Added audio connector to README * Minor docs edits --------- Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com> * Bump version: v4.8.1 → v4.9.0 --------- Co-authored-by: Jeff Swartz <jeff.swartz@vonage.com>
1 parent ed5cbc4 commit 74abd63

File tree

13 files changed

+490
-36
lines changed

13 files changed

+490
-36
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 = False
4-
current_version = v4.8.1
4+
current_version = v4.9.0
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
66
serialize =
77
{major}.{minor}.{patch}-{release}{build}

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
path: ~/.gradle/caches
2424
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
2525
restore-keys: ${{ runner.os }}-gradle
26-
- name: publish with gradle
26+
- name: Publish with Gradle
2727
env:
2828
signingKey: ${{secrets.SIGNING_KEY}}
2929
signingPassword: ${{secrets.SIGNING_PASSWORD}}

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ The OpenTok Java SDK provides methods for:
1616
* [Sending signals to clients connected to a session](https://tokbox.com/developer/guides/signaling/)
1717
* [Disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/)
1818
* [Forcing clients in a session to disconnect or mute published audio](https://tokbox.com/developer/guides/moderation/)
19-
* Working with OpenTok [Experience Composers](https://tokbox.com/developer/guides/experience-composer)
19+
* Working with [Experience Composers](https://tokbox.com/developer/guides/experience-composer)
20+
* Working with [Audio Connectors](/https://tokbox.com/developer/guides/audio-connector)
2021

2122
## Installation
2223

@@ -33,7 +34,7 @@ When you use Maven as your build tool, you can manage dependencies in the `pom.x
3334
<dependency>
3435
<groupId>com.tokbox</groupId>
3536
<artifactId>opentok-server-sdk</artifactId>
36-
<version>4.8.1</version>
37+
<version>4.9.0</version>
3738
</dependency>
3839
```
3940

@@ -43,7 +44,7 @@ When you use Gradle as your build tool, you can manage dependencies in the `buil
4344

4445
```groovy
4546
dependencies {
46-
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.8.1'
47+
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.9.0'
4748
}
4849
```
4950

@@ -579,7 +580,7 @@ method:
579580

580581
```java
581582
RenderProperties properties = new RenderProperties.Builder()
582-
.url(("http://example.com/path-to-page/")
583+
.url("http://example.com/path-to-page/")
583584
.build();
584585

585586
Render render = opentok.startRender(sessionId, token, properties);
@@ -590,6 +591,22 @@ You can stop an Experience Composer by calling the `OpenTok.stopRender(String re
590591
You can get information about Experience Composers by calling the `OpenTok.getRender(String renderId)`,
591592
`OpenTok.listRenders()` or `OpenTok.listRenders(Integer offset, Integer count)` methods.
592593

594+
### Working with Audio Connector
595+
596+
You can start an [Audio Connector stream](https://tokbox.com/developer/guides/audio-connector)
597+
by calling the `OpenTok.connectAudioStream(String sessionId, String token, AudioConnectorProperties properties)`
598+
method:
599+
600+
```java
601+
AudioConnectorProperties properties = new AudioConnectorProperties.Builder("wss://service.com/ws-endpoint")
602+
.addStreams("streamId-1", "streamId-2")
603+
.addHeader("X-CustomHeader-Key", "headerValue")
604+
.build();
605+
606+
AudioConnector ac = opentok.connectAudioStream(sessionId, token, properties);
607+
```
608+
609+
593610
## Samples
594611

595612
There are two sample applications included with the SDK. To get going as fast as possible, clone the whole

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111

1212
group = 'com.tokbox'
1313
archivesBaseName = 'opentok-server-sdk'
14-
version = '4.8.1'
14+
version = '4.9.0'
1515
sourceCompatibility = "1.8"
1616
targetCompatibility = "1.8"
1717

@@ -27,9 +27,10 @@ dependencies {
2727
implementation 'commons-lang:commons-lang:2.6'
2828
implementation 'commons-validator:commons-validator:1.7'
2929
implementation 'org.asynchttpclient:async-http-client:2.12.3'
30-
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.1'
30+
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
3131
implementation 'commons-codec:commons-codec:1.15'
32-
implementation 'org.bitbucket.b_c:jose4j:0.9.2'
32+
implementation 'org.bitbucket.b_c:jose4j:0.9.3'
33+
implementation 'io.netty:netty-handler:4.1.89.Final'
3334
}
3435

3536
task sourcesJar(type: Jar) {

sample/Archiving/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repositories {
88
dependencies {
99
implementation project(':')
1010
implementation 'com.github.codingricky:spark-core-16:1.1'
11-
implementation 'org.freemarker:freemarker:2.3.19'
12-
implementation 'org.slf4j:slf4j-simple:1.7.6'
11+
implementation 'org.freemarker:freemarker:2.3.32'
12+
implementation 'org.slf4j:slf4j-simple:1.7.36'
1313
}
1414

1515
run.systemProperty 'API_KEY', ''

sample/HelloWorld/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repositories {
88
dependencies {
99
implementation project(':')
1010
implementation 'com.github.codingricky:spark-core-16:1.1'
11-
implementation 'org.freemarker:freemarker:2.3.19'
12-
implementation 'org.slf4j:slf4j-simple:1.7.6'
11+
implementation 'org.freemarker:freemarker:2.3.32'
12+
implementation 'org.slf4j:slf4j-simple:1.7.36'
1313
}
1414

1515
run.systemProperty 'API_KEY', ''

settings.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
include 'sample:HelloWorld'
2-
include 'sample:Archiving'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* OpenTok Java SDK
3+
* Copyright (C) 2023 Vonage.
4+
* http://www.tokbox.com
5+
*
6+
* Licensed under The MIT License (MIT). See LICENSE file for more information.
7+
*/
8+
package com.opentok;
9+
10+
import com.fasterxml.jackson.annotation.JsonCreator;
11+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
12+
import com.fasterxml.jackson.annotation.JsonProperty;
13+
14+
/**
15+
* Represents an Audio Connector instance.
16+
*/
17+
@JsonIgnoreProperties(ignoreUnknown=true)
18+
public class AudioConnector {
19+
@JsonProperty private String id;
20+
@JsonProperty private String connectionId;
21+
22+
protected AudioConnector() {}
23+
24+
/**
25+
* Do not call this method. To initiate an audio stream connection to a session, call the
26+
* {@link OpenTok#connectAudioStream(String, String, AudioConnectorProperties)} method.
27+
*/
28+
@JsonCreator
29+
public static AudioConnector makeConnection() {
30+
return new AudioConnector();
31+
}
32+
33+
/**
34+
* @return A unique ID identifying the Audio Connector WebSocket connection.
35+
*/
36+
public String getId() {
37+
return id;
38+
}
39+
40+
/**
41+
* @return The OpenTok connection ID for the Audio Connector WebSocket connection in the OpenTok session.
42+
*/
43+
public String getConnectionId() {
44+
return connectionId;
45+
}
46+
}
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
/**
2+
* OpenTok Java SDK
3+
* Copyright (C) 2023 Vonage.
4+
* http://www.tokbox.com
5+
*
6+
* Licensed under The MIT License (MIT). See LICENSE file for more information.
7+
*/
8+
package com.opentok;
9+
10+
import org.apache.commons.lang.StringUtils;
11+
12+
import java.net.URI;
13+
import java.util.*;
14+
15+
/**
16+
* Defines values for the <code>properties</code> parameter of the
17+
* {@link OpenTok#connectAudioStream(String, String, AudioConnectorProperties)} method.
18+
*/
19+
public class AudioConnectorProperties {
20+
private final URI uri;
21+
private final Collection<String> streams;
22+
private final Map<String, String> headers;
23+
24+
/**
25+
* The WebSocket URI to be used for the destination of the audio stream.
26+
*
27+
* @return A valid, non-null URI.
28+
*/
29+
public URI uri() {
30+
return uri;
31+
}
32+
33+
/**
34+
* (OPTIONAL)
35+
* A collection of stream IDs for the OpenTok streams included in the WebSocket audio.
36+
* If this collection is empty, all streams in the session will be included.
37+
*
38+
* @return An immutable collection of stream IDs, if present.
39+
*/
40+
public Collection<String> streams() {
41+
return streams;
42+
}
43+
44+
/**
45+
* Additional headers to include in the request body.
46+
* NOTE: The maximum length is 512 bytes.
47+
*
48+
* @return An immutable map of additional properties, if present.
49+
*/
50+
public Map<String, String> headers() {
51+
return headers;
52+
}
53+
54+
/**
55+
* Returns the name of the JSON object for the connection request body.
56+
*
57+
* @return "websocket".
58+
*/
59+
public String type() {
60+
return "websocket";
61+
}
62+
63+
protected AudioConnectorProperties(Builder builder) {
64+
this.uri = Objects.requireNonNull(builder.uri);
65+
this.streams = builder.streams.isEmpty() ? null : Collections.unmodifiableCollection(builder.streams);
66+
this.headers = builder.headers.isEmpty() ? null : Collections.unmodifiableMap(builder.headers);
67+
}
68+
69+
/**
70+
* Intermediary stateful object used to construct {@link AudioConnectorProperties}.
71+
*/
72+
public static class Builder {
73+
private final URI uri;
74+
private final Collection<String> streams = new ArrayList<>();
75+
private final Map<String, String> headers = new HashMap<>();
76+
77+
/**
78+
* Constructor for the AudioConnectorProperties.Builder, using a URI to
79+
* define the WebSocket URI.
80+
*
81+
* @param uri The publicly reachable WebSocket URI to be used for the destination
82+
* of the audio stream.
83+
*/
84+
public Builder(URI uri) {
85+
this.uri = uri;
86+
}
87+
88+
/**
89+
* Constructor for the AudioConnectorProperties.Builder, using a string to
90+
* define the WebSocket URI.
91+
*
92+
* @param uri The publicly reachable WebSocket URI to be used for the destination of
93+
* the audio stream, as a string (such as "wss://example.com/ws-endpoint").
94+
*/
95+
public Builder(String uri) {
96+
this(URI.create(uri));
97+
}
98+
99+
/**
100+
* Adds an OpenTok stream (with the corresponding stream ID) to include in the WebSocket audio.
101+
* If the AudioConnectorProperties includes no streams, all streams in the session
102+
* will be included.
103+
*
104+
* @param stream The stream ID.
105+
*
106+
* @return This builder with the additional stream ID.
107+
*/
108+
public Builder addStream(String stream) {
109+
if (StringUtils.isBlank(stream)) {
110+
throw new IllegalArgumentException("Stream ID cannot be blank");
111+
}
112+
streams.add(stream);
113+
return this;
114+
}
115+
116+
/**
117+
* Adds OpenTok streams (with the corresponding stream IDs) to include in the WebSocket audio.
118+
* If the AudioConnectorProperties includes no streams, all streams in the session
119+
* will be included.
120+
*
121+
* @param streams The stream IDs to add.
122+
*
123+
* @return This builder with the additional stream IDs.
124+
*/
125+
public Builder addStreams(String... streams) {
126+
return addStreams(Arrays.asList(streams));
127+
}
128+
129+
/**
130+
* Adds OpenTok streams (with the corresponding stream IDs) to include in the WebSocket audio.
131+
* If the AudioConnectorProperties includes no streams, all streams in the session
132+
* will be included.
133+
*
134+
* @param streams The collection of stream IDs to add.
135+
*
136+
* @return This builder with the additional stream IDs.
137+
*/
138+
public Builder addStreams(Collection<String> streams) {
139+
this.streams.addAll(Objects.requireNonNull(streams));
140+
return this;
141+
}
142+
143+
/**
144+
* Puts all entries of the map into the headers parameter. The headers will
145+
* be sent to your WebSocket server with each message.
146+
*
147+
* @param headers The map of header key-value pairs to append.
148+
*
149+
* @return This builder with the specified headers included.
150+
*/
151+
public Builder addHeaders(Map<String, String> headers) {
152+
this.headers.putAll(Objects.requireNonNull(headers));
153+
return this;
154+
}
155+
156+
/**
157+
* Adds a header entry to this object's headers property. The header will
158+
* be sent to your WebSocket server with each message.
159+
*
160+
* @param key Header key.
161+
* @param value Header value.
162+
*
163+
* @return This builder with the additional header property.
164+
*/
165+
public Builder addHeader(String key, String value) {
166+
if (StringUtils.isBlank(key)) {
167+
throw new IllegalArgumentException("Property key cannot be blank");
168+
}
169+
headers.put(key, value);
170+
return this;
171+
}
172+
173+
/**
174+
* Builds the AudioConnectorProperties object.
175+
*
176+
* @return The constructed {@link AudioConnectorProperties} object.
177+
*/
178+
public AudioConnectorProperties build() {
179+
return new AudioConnectorProperties(this);
180+
}
181+
}
182+
183+
}

0 commit comments

Comments
 (0)