Skip to content

Commit

Permalink
v4.9.0 Release (#235)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* Bump version: v4.8.1 → v4.9.0

---------

Co-authored-by: Jeff Swartz <[email protected]>
  • Loading branch information
SMadani and jeffswartz authored Mar 9, 2023
1 parent ed5cbc4 commit 74abd63
Show file tree
Hide file tree
Showing 13 changed files with 490 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = True
tag = False
current_version = v4.8.1
current_version = v4.9.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{build}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: publish with gradle
- name: Publish with Gradle
env:
signingKey: ${{secrets.SIGNING_KEY}}
signingPassword: ${{secrets.SIGNING_PASSWORD}}
Expand Down
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ The OpenTok Java SDK provides methods for:
* [Sending signals to clients connected to a session](https://tokbox.com/developer/guides/signaling/)
* [Disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/)
* [Forcing clients in a session to disconnect or mute published audio](https://tokbox.com/developer/guides/moderation/)
* Working with OpenTok [Experience Composers](https://tokbox.com/developer/guides/experience-composer)
* Working with [Experience Composers](https://tokbox.com/developer/guides/experience-composer)
* Working with [Audio Connectors](/https://tokbox.com/developer/guides/audio-connector)

## Installation

Expand All @@ -33,7 +34,7 @@ When you use Maven as your build tool, you can manage dependencies in the `pom.x
<dependency>
<groupId>com.tokbox</groupId>
<artifactId>opentok-server-sdk</artifactId>
<version>4.8.1</version>
<version>4.9.0</version>
</dependency>
```

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

```groovy
dependencies {
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.8.1'
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.9.0'
}
```

Expand Down Expand Up @@ -579,7 +580,7 @@ method:

```java
RenderProperties properties = new RenderProperties.Builder()
.url(("http://example.com/path-to-page/")
.url("http://example.com/path-to-page/")
.build();

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

### Working with Audio Connector

You can start an [Audio Connector stream](https://tokbox.com/developer/guides/audio-connector)
by calling the `OpenTok.connectAudioStream(String sessionId, String token, AudioConnectorProperties properties)`
method:

```java
AudioConnectorProperties properties = new AudioConnectorProperties.Builder("wss://service.com/ws-endpoint")
.addStreams("streamId-1", "streamId-2")
.addHeader("X-CustomHeader-Key", "headerValue")
.build();

AudioConnector ac = opentok.connectAudioStream(sessionId, token, properties);
```


## Samples

There are two sample applications included with the SDK. To get going as fast as possible, clone the whole
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {

group = 'com.tokbox'
archivesBaseName = 'opentok-server-sdk'
version = '4.8.1'
version = '4.9.0'
sourceCompatibility = "1.8"
targetCompatibility = "1.8"

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

task sourcesJar(type: Jar) {
Expand Down
4 changes: 2 additions & 2 deletions sample/Archiving/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ repositories {
dependencies {
implementation project(':')
implementation 'com.github.codingricky:spark-core-16:1.1'
implementation 'org.freemarker:freemarker:2.3.19'
implementation 'org.slf4j:slf4j-simple:1.7.6'
implementation 'org.freemarker:freemarker:2.3.32'
implementation 'org.slf4j:slf4j-simple:1.7.36'
}

run.systemProperty 'API_KEY', ''
Expand Down
4 changes: 2 additions & 2 deletions sample/HelloWorld/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ repositories {
dependencies {
implementation project(':')
implementation 'com.github.codingricky:spark-core-16:1.1'
implementation 'org.freemarker:freemarker:2.3.19'
implementation 'org.slf4j:slf4j-simple:1.7.6'
implementation 'org.freemarker:freemarker:2.3.32'
implementation 'org.slf4j:slf4j-simple:1.7.36'
}

run.systemProperty 'API_KEY', ''
Expand Down
2 changes: 0 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
include 'sample:HelloWorld'
include 'sample:Archiving'
46 changes: 46 additions & 0 deletions src/main/java/com/opentok/AudioConnector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* OpenTok Java SDK
* Copyright (C) 2023 Vonage.
* http://www.tokbox.com
*
* Licensed under The MIT License (MIT). See LICENSE file for more information.
*/
package com.opentok;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Represents an Audio Connector instance.
*/
@JsonIgnoreProperties(ignoreUnknown=true)
public class AudioConnector {
@JsonProperty private String id;
@JsonProperty private String connectionId;

protected AudioConnector() {}

/**
* Do not call this method. To initiate an audio stream connection to a session, call the
* {@link OpenTok#connectAudioStream(String, String, AudioConnectorProperties)} method.
*/
@JsonCreator
public static AudioConnector makeConnection() {
return new AudioConnector();
}

/**
* @return A unique ID identifying the Audio Connector WebSocket connection.
*/
public String getId() {
return id;
}

/**
* @return The OpenTok connection ID for the Audio Connector WebSocket connection in the OpenTok session.
*/
public String getConnectionId() {
return connectionId;
}
}
183 changes: 183 additions & 0 deletions src/main/java/com/opentok/AudioConnectorProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
/**
* OpenTok Java SDK
* Copyright (C) 2023 Vonage.
* http://www.tokbox.com
*
* Licensed under The MIT License (MIT). See LICENSE file for more information.
*/
package com.opentok;

import org.apache.commons.lang.StringUtils;

import java.net.URI;
import java.util.*;

/**
* Defines values for the <code>properties</code> parameter of the
* {@link OpenTok#connectAudioStream(String, String, AudioConnectorProperties)} method.
*/
public class AudioConnectorProperties {
private final URI uri;
private final Collection<String> streams;
private final Map<String, String> headers;

/**
* The WebSocket URI to be used for the destination of the audio stream.
*
* @return A valid, non-null URI.
*/
public URI uri() {
return uri;
}

/**
* (OPTIONAL)
* A collection of stream IDs for the OpenTok streams included in the WebSocket audio.
* If this collection is empty, all streams in the session will be included.
*
* @return An immutable collection of stream IDs, if present.
*/
public Collection<String> streams() {
return streams;
}

/**
* Additional headers to include in the request body.
* NOTE: The maximum length is 512 bytes.
*
* @return An immutable map of additional properties, if present.
*/
public Map<String, String> headers() {
return headers;
}

/**
* Returns the name of the JSON object for the connection request body.
*
* @return "websocket".
*/
public String type() {
return "websocket";
}

protected AudioConnectorProperties(Builder builder) {
this.uri = Objects.requireNonNull(builder.uri);
this.streams = builder.streams.isEmpty() ? null : Collections.unmodifiableCollection(builder.streams);
this.headers = builder.headers.isEmpty() ? null : Collections.unmodifiableMap(builder.headers);
}

/**
* Intermediary stateful object used to construct {@link AudioConnectorProperties}.
*/
public static class Builder {
private final URI uri;
private final Collection<String> streams = new ArrayList<>();
private final Map<String, String> headers = new HashMap<>();

/**
* Constructor for the AudioConnectorProperties.Builder, using a URI to
* define the WebSocket URI.
*
* @param uri The publicly reachable WebSocket URI to be used for the destination
* of the audio stream.
*/
public Builder(URI uri) {
this.uri = uri;
}

/**
* Constructor for the AudioConnectorProperties.Builder, using a string to
* define the WebSocket URI.
*
* @param uri The publicly reachable WebSocket URI to be used for the destination of
* the audio stream, as a string (such as "wss://example.com/ws-endpoint").
*/
public Builder(String uri) {
this(URI.create(uri));
}

/**
* Adds an OpenTok stream (with the corresponding stream ID) to include in the WebSocket audio.
* If the AudioConnectorProperties includes no streams, all streams in the session
* will be included.
*
* @param stream The stream ID.
*
* @return This builder with the additional stream ID.
*/
public Builder addStream(String stream) {
if (StringUtils.isBlank(stream)) {
throw new IllegalArgumentException("Stream ID cannot be blank");
}
streams.add(stream);
return this;
}

/**
* Adds OpenTok streams (with the corresponding stream IDs) to include in the WebSocket audio.
* If the AudioConnectorProperties includes no streams, all streams in the session
* will be included.
*
* @param streams The stream IDs to add.
*
* @return This builder with the additional stream IDs.
*/
public Builder addStreams(String... streams) {
return addStreams(Arrays.asList(streams));
}

/**
* Adds OpenTok streams (with the corresponding stream IDs) to include in the WebSocket audio.
* If the AudioConnectorProperties includes no streams, all streams in the session
* will be included.
*
* @param streams The collection of stream IDs to add.
*
* @return This builder with the additional stream IDs.
*/
public Builder addStreams(Collection<String> streams) {
this.streams.addAll(Objects.requireNonNull(streams));
return this;
}

/**
* Puts all entries of the map into the headers parameter. The headers will
* be sent to your WebSocket server with each message.
*
* @param headers The map of header key-value pairs to append.
*
* @return This builder with the specified headers included.
*/
public Builder addHeaders(Map<String, String> headers) {
this.headers.putAll(Objects.requireNonNull(headers));
return this;
}

/**
* Adds a header entry to this object's headers property. The header will
* be sent to your WebSocket server with each message.
*
* @param key Header key.
* @param value Header value.
*
* @return This builder with the additional header property.
*/
public Builder addHeader(String key, String value) {
if (StringUtils.isBlank(key)) {
throw new IllegalArgumentException("Property key cannot be blank");
}
headers.put(key, value);
return this;
}

/**
* Builds the AudioConnectorProperties object.
*
* @return The constructed {@link AudioConnectorProperties} object.
*/
public AudioConnectorProperties build() {
return new AudioConnectorProperties(this);
}
}

}
Loading

0 comments on commit 74abd63

Please sign in to comment.