Full code is can be found here: https://github.com/apivideo/java-sdk
This SDK provides a Java client for api.video service. This is an early version, feel free to report any issue.
Install
With Gradle
Download the latest release.
Add the following dependencies in your
build.gradle file:
// build.gradle
dependencies {
implementation 'com.konghq:unirest-java:2.3.17'
implementation files('libs/java-sdk-0.2.0.jar')
}
Quick start
import java.io.File;
import video.api.java.sdk.Client;
import video.api.java.sdk.ClientFactory;
import video.api.java.sdk.domain.exception.ResponseException;
import video.api.java.sdk.domain.video.Video;
public class Main {
public static void main(String[] args) throws ResponseException {
Client client = new ClientFactory().create("YourProductionApiKey");
// Client client = new ClientFactory().createSandbox("YourSandboxApiKey");
// Upload a new video
Video video = client.videos.upload(new File("/path/to/file.mp4"));
// Get its embed code
```
String embedCode = video.assets.get("iframe"); // <iframe src="..."></iframe>
}
}
## Video
```java
// Upload a video with properties
Video video = new Video();
video.title = "My title";
video.tags.add("my tag");
video = client.videos.upload(new File("/path/to/file.mp4"), video);
// Iterate over videos (paging is handled by the client)
for (Video v : client.videos.list()) {
String videoTitle = v.title;
}
More generally, you can use the following for all video related calls:
client.videos;
Live Streaming
client.liveStreams;
Captions
client.captions;
Player
client.players;
Statistics and Analytics
client.liveStreamAnalytics;
client.sessionEventAnalytics;
client.videoAnalytics;
Updated 5 months ago