Skip to content

Commit

Permalink
Add Broadcast to video API (#437)
Browse files Browse the repository at this point in the history
* Added Broadcast endpoints & classes

* 100% Broadcast coverage

* Bumped dependencies

* Deleted CreateArchiveRequest & improved coverage

* Rearranged order of endpoints in VideoClient

* Stronger typing

* Fixes based on actual E2E testing

* UUID for VideoStream#getStreamId

* Docs updates & minor QoL

* Broadcast returns streams

* Bump version: v8.0.0-beta3 → v8.0.0-beta4

* Added date to 8.v4
  • Loading branch information
SMadani authored Feb 24, 2023
1 parent 45057d6 commit d6d7efd
Show file tree
Hide file tree
Showing 66 changed files with 3,545 additions and 829 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 = v8.0.0-beta3
current_version = v8.0.0-beta4
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [8.0.0-beta4]
## [8.0.0-beta4] - 2023-02-24
- Removed Payments over the Phone NCCO
- Added SIP functionality to video API
- Added Broadcast functionality to video API
- Refactored Archives for consistency with Broadcast
- Use UUID as return type for IDs where applicable

## [8.0.0-beta3] - 2023-01-11
- Removed `WAPPush` SMS message type
Expand Down
88 changes: 81 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ For Gradle 3.4 or Higher:

```groovy
dependencies {
implementation 'com.vonage:server-sdk:8.0.0-beta3'
implementation 'com.vonage:server-sdk:8.0.0-beta4'
}
```

For older versions:

```groovy
dependencies {
compile 'com.vonage:server-sdk:8.0.0-beta3'
compile 'com.vonage:server-sdk:8.0.0-beta4'
}
```

Expand All @@ -61,7 +61,7 @@ Add the following to the correct place in your project's POM file:
<dependency>
<groupId>com.vonage</groupId>
<artifactId>server-sdk</artifactId>
<version>8.0.0-beta3</version>
<version>8.0.0-beta4</version>
</dependency>
```

Expand Down Expand Up @@ -500,7 +500,7 @@ SignalRequest request = SignalRequest.builder()
client.getVideoClient().signal(SESSION_ID, CONNECTION_ID, request);
```

Signal all participants in a session:
### Signal all participants in a session:
```java
SignalRequest request = SignalRequest.builder()
.type("chat").data("Hello, World!").build();
Expand All @@ -517,15 +517,15 @@ GetStreamResponse streamInfo = client.getVideoClient().getStream(SESSION_ID, STR

Archive a recording of a Vonage Video session. All properties (except `SESSION_ID`) are optional.
```java
Archive archive = client.getVideoClient().startArchive(
CreateArchiveRequest.builder(SESSION_ID)
Archive archive = client.getVideoClient().createArchive(
Archive.builder(SESSION_ID)
.name("My_Recording")
.outputMode(OutputMode.COMPOSED)
.streamMode(StreamMode.AUTO)
.resolution(Resolution.HD_LANDSCAPE)
.hasAudio(true).hasVideo(true)
.layout(
ArchiveLayout.builder(ScreenLayoutType.BEST_FIT)
StreamCompositionLayout.builder(ScreenLayoutType.BEST_FIT)
.screenshareType(ScreenLayoutType.PIP)
.build()
)
Expand All @@ -539,6 +539,24 @@ Archive archive = client.getVideoClient().startArchive(
Archive archive = client.getVideoClient().stopArchive(ARCHIVE_ID);
```

### Delete an Archive recording

```java
Archive archive = client.getVideoClient().deleteArchive(ARCHIVE_ID);
```

### Get details about a specific Archive

```java
Archive archive = client.getVideoClient().getArchive(ARCHIVE_ID);
```

### List the most recent completed Archives

```java
List<Archive> archives = client.getVideoClient().listArchives();
```

### Add or remove stream in an Archive recording

Change the streams included in a composed archive that was started with the streamMode set to "manual":
Expand All @@ -549,6 +567,62 @@ client.getVideoClient().addArchiveStream(ARCHIVE_ID, STREAM_ID);
client.getVideoClient().removeArchiveStream(ARCHIVE_ID, STREAM_ID);
```

### List all live Broadcasts

```java
List<Broadcast> broadcasts = client.getVideoClient().listBroadcasts();
```

### Get details about a specific Broadcast

```java
Broadcast broadcast = client.getVideoClient().getBroadcast(BROADCAST_ID);
```

### Start a live streaming Broadcast
To successfully start broadcasting a session, at least one client must be connected to the session.
The live streaming broadcast can target one HLS endpoint and up to five RTMP servers simultaneously for a session.
Session ID is required and at least one output stream (RTMP and/or HLS) should be specified.

```java
Broadcast broadcast = client.getVideoClient().createBroadcast(
Broadcast.builder(SESSION_ID)
.hls(Hls.builder().lowLatency(true).build())
.resolution(Resolution.HD_LANDSCAPE)
.streamMode(StreamMode.MANUAL)
.layout(StreamCompositionLayout.builder(ScreenLayoutType.BEST_FIT)
.screenshareType(ScreenLayoutType.PIP)
.build()
)
.maxDuration(Duration.ofMinutes(45))
.build()
);
```

### Stop a Broadcast recording

```java
Broadcast broadcast = client.getVideoClient().stopBroadcast(BROADCAST_ID);
```

### Dynamically changing the layout type of a live streaming Broadcast

```java
client.getVideoClient().updateBroadcastLayout(BROADCAST_ID,
StreamCompositionLayout.builder(ScreenLayoutType.HORIZONTAL).build()
);
```

### Add or remove stream in a live streaming Broadcast

Change the streams included in a broadcast that was started with the streamMode set to "manual":
```java
client.getVideoClient().addBroadcastStream(BROADCAST_ID, STREAM_ID);
```
```java
client.getVideoClient().removeBroadcastStream(BROADCAST_ID, STREAM_ID);
```

### Custom HTTP Configuration

If you need to configure the Apache HttpClient used for making requests, you can
Expand Down
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

group = "com.vonage"
archivesBaseName = "server-sdk"
version = "8.0.0-beta3"
version = "8.0.0-beta4"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"

Expand All @@ -24,22 +24,22 @@ repositories {
}

dependencies {
compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
compileOnly 'jakarta.servlet:jakarta.servlet-api:4.0.4'

implementation 'commons-codec:commons-codec:1.15'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
implementation 'io.openapitools.jackson.dataformat:jackson-dataformat-hal:1.0.9'
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'com.vonage:jwt:1.0.2'

testImplementation 'javax.servlet:javax.servlet-api:4.0.1'
testImplementation 'jakarta.servlet:jakarta.servlet-api:4.0.4'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-inline:4.8.0'
testImplementation 'org.mockito:mockito-inline:4.11.0'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.springframework:spring-test:5.3.23'
testImplementation 'org.springframework:spring-web:5.3.23'
testImplementation 'org.springframework:spring-test:5.3.25'
testImplementation 'org.springframework:spring-websocket:5.3.25'
}

test {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/vonage/client/HttpWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
public class HttpWrapper {
private static final String CLIENT_NAME = "vonage-java-sdk";
private static final String CLIENT_VERSION = "8.0.0-beta3";
private static final String CLIENT_VERSION = "8.0.0-beta4";
private static final String JAVA_VERSION = System.getProperty("java.version");
private static final String USER_AGENT = String.format("%s/%s java/%s", CLIENT_NAME, CLIENT_VERSION, JAVA_VERSION);

Expand Down
Loading

0 comments on commit d6d7efd

Please sign in to comment.