-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
ed5cbc4
commit 74abd63
Showing
13 changed files
with
490 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
include 'sample:HelloWorld' | ||
include 'sample:Archiving' | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
183
src/main/java/com/opentok/AudioConnectorProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.