/wsc-sdk-java

The official Java SDK for the Wowza Streaming Cloud service by Wowza Media Systems

Primary LanguageHTMLBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

wowza streaming cloud java sdk logo

Wowza Streaming Cloud Java SDK

Welcome to the official Wowza Streaming Cloud Java SDK. We help developers bring live streaming into their applications - for any size audience, anywhere in the world. This SDK leverages the Wowza Streaming Cloud REST API to programmatically control live streaming workflows.

Need the basics? Get to know Wowza Streaming Cloud and the Wowza Streaming Cloud REST API.

SDK version

v1.3.1 (references Wowza Streaming Cloud REST API version 1.3)

Contents

Examples

Check out example files to help you get started.

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.wowza.cloudsdk</groupId>
  <artifactId>WowzaCloudSDK-java-client</artifactId>
  <version>1.3.1</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.wowza.cloudsdk:WowzaCloudSDK-java-client:1.3.1"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/WowzaCloudSDK-java-client-1.3.1.jar
  • target/lib/*.jar

Get your API key and generate an access key

Start by getting an API key and access key to authenticate requests. You'll find them in the Wowza Streaming Cloud user interface.

  1. Sign in to Wowza Streaming Cloud.

  2. In the menu bar, click your user name and choose API Access.

See Locate an API key and generate an access key for more information.

  1. You do not need to supply the wsc-signature or wsc-timestamp authentication options as these are calculated automatically for each request.

Getting Started

Please follow the installation instructions and execute the following Java code:

package LiveStreams;

import com.wowza.cloudsdk.client.*;
import com.wowza.cloudsdk.client.auth.*;
import com.wowza.cloudsdk.client.model.*;
import com.wowza.cloudsdk.client.api.LiveStreamsApi;

import java.io.File;
import java.util.*;

public class CreateALiveStreamExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: wsc-access-key
        ApiKeyAuth wscaccesskey = (ApiKeyAuth)defaultClient.getAuthentication("wsc-access-key");
        wscaccesskey.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //wsc-access-key.setApiKeyPrefix("Token");

        // Configure API key authorization: wsc-api-key
        ApiKeyAuth wscapikey = (ApiKeyAuth)defaultClient.getAuthentication("wsc-api-key");
        wscapikey.setApiKey("YOUR API KEY");
        // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
        //wsc-api-key.setApiKeyPrefix("Token");

        LiveStreamsApi apiInstance = new LiveStreamsApi();

        LiveStream liveStream = new LiveStream(); // LiveStream | Provide the details of the live stream to create in the body of the request.
        liveStream.setName("JavaStreamCreate"+System.currentTimeMillis());
        liveStream.setAspectRatioHeight(1080);
        liveStream.setAspectRatioWidth(1920);
        liveStream.setBillingMode(LiveStream.BillingModeEnum.PAY_AS_YOU_GO);
        liveStream.setBroadcastLocation(LiveStream.BroadcastLocationEnum.EU_GERMANY);
        liveStream.setClosedCaptionType(LiveStream.ClosedCaptionTypeEnum.NONE);
        liveStream.setDeliveryMethod(LiveStream.DeliveryMethodEnum.PUSH);
        liveStream.setDeliveryType(LiveStream.DeliveryTypeEnum.SINGLE_BITRATE);
        liveStream.setEncoder(LiveStream.EncoderEnum.WOWZA_GOCODER);
        liveStream.setHostedPage(false);

        /**
        liveStream.setHostedPageDescription("hostedDescription");
        liveStream.setHostedPageLogoImageUrl("http://www.wowza.com/imageURL");
        liveStream.setHostedPageSharingIcons(true);
        liveStream.setHostedPageTitle("pageTitleHERE");
        liveStream.setHostedPageUrl("http://www.wowza.com/pageURL");
        **/

        //liveStream.setLowLatency(true);
        liveStream.setPlayerWidth(720);
        liveStream.setTargetDeliveryProtocol(LiveStream.TargetDeliveryProtocolEnum.HTTPS);
        liveStream.setRecording(false);
        liveStream.setTranscoderType(LiveStream.TranscoderTypeEnum.TRANSCODED);
        liveStream.setUseStreamSource(false);
        List<String> deliveryProtocols = new ArrayList<String>();
        deliveryProtocols.add("rtmp");
        deliveryProtocols.add("rtsp");
        deliveryProtocols.add("wowz");
        liveStream.setDeliveryProtocols(deliveryProtocols);
        liveStream.hostedPage(true);
        liveStream.hostedPageDescription("My JavaStreamCreate");
        liveStream.hostedPageSharingIcons(true);
        liveStream.hostedPageTitle("Title host JavaStreamCreate");
        liveStream.lowLatency(false);
        liveStream.playerCountdown(false);
        liveStream.playerResponsive(false);
        liveStream.playerType("wowza_player");
        liveStream.playerWidth(640);
        liveStream.recording(false);
        liveStream.useStreamSource(false);
        liveStream.setTargetDeliveryProtocol(LiveStream.TargetDeliveryProtocolEnum.HTTPS);
        liveStream.setDisableAuthentication(false);
        liveStream.setUsername("java");
        liveStream.setPassword("tseTKDSavaJ");

	try {
	    LiveStream result = apiInstance.createLiveStream(liveStream);
	    System.out.println(result);
	} catch (ApiException e) {
	    System.err.println("Exception when calling LiveStreamsApi#createLiveStream");
	    e.printStackTrace();
	}
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.cloud.wowza.com/api/v1.3

Class Method HTTP request Description
LiveStreamsApi createLiveStream POST /live_streams Create a live stream
LiveStreamsApi deleteLiveStream DELETE /live_streams/{id} Delete a live stream
LiveStreamsApi listLiveStreams GET /live_streams Fetch all live streams
LiveStreamsApi regenerateConnectionCodeLiveStream PUT /live_streams/{id}/regenerate_connection_code Regenerate the connection code for a live stream
LiveStreamsApi resetLiveStream PUT /live_streams/{id}/reset Reset a live stream
LiveStreamsApi showLiveStream GET /live_streams/{id} Fetch a live stream
LiveStreamsApi showLiveStreamState GET /live_streams/{id}/state Fetch the state of a live stream
LiveStreamsApi showLiveStreamStats GET /live_streams/{id}/stats Fetch metrics for an active live stream
LiveStreamsApi showLiveStreamThumbnailUrl GET /live_streams/{id}/thumbnail_url Fetch the thumbnail URL of a live stream
LiveStreamsApi startLiveStream PUT /live_streams/{id}/start Start a live stream
LiveStreamsApi stopLiveStream PUT /live_streams/{id}/stop Stop a live stream
LiveStreamsApi updateLiveStream PATCH /live_streams/{id} Update a live stream
NetworkApi usageNetworkStreamSourcesIndex GET /usage/network/stream_sources Fetch network usage for all stream sources
NetworkApi usageNetworkStreamTargetsIndex GET /usage/network/stream_targets Fetch network usage for all stream targets
NetworkApi usageNetworkTranscodersIndex GET /usage/network/transcoders Fetch network usage for all transcoders
PlayersApi createPlayerUrl POST /players/{player_id}/urls Create a player URL
PlayersApi deletePlayerUrl DELETE /players/{player_id}/urls/{id} Delete a player URL
PlayersApi listPlayerUrls GET /players/{player_id}/urls Fetch all player URLs
PlayersApi listPlayers GET /players Fetch all players
PlayersApi requestPlayerRebuild POST /players/{id}/rebuild Rebuild player code
PlayersApi showPlayer GET /players/{id} Fetch a player
PlayersApi showPlayerState GET /players/{id}/state Fetch the state of a player
PlayersApi showPlayerUrl GET /players/{player_id}/urls/{id} Fetch a player URL
PlayersApi updatePlayer PATCH /players/{id} Update a player
PlayersApi updatePlayerUrl PATCH /players/{player_id}/urls/{id} Update a player URL
ProcessingTimeApi usageTimeTranscodersIndex GET /usage/time/transcoders Fetch stream processing time
RecordingsApi deleteRecording DELETE /recordings/{id} Delete a recording
RecordingsApi listRecordings GET /recordings Fetch all recordings
RecordingsApi showRecording GET /recordings/{id} Fetch a recording
RecordingsApi showRecordingState GET /recordings/{id}/state Fetch the state of a recording
SchedulesApi createSchedule POST /schedules Create a schedule
SchedulesApi deleteSchedule DELETE /schedules/{id} Delete a schedule
SchedulesApi disableSchedule PUT /schedules/{id}/disable Disable a schedule
SchedulesApi enableSchedule PUT /schedules/{id}/enable Enable a schedule
SchedulesApi listSchedules GET /schedules Fetch all schedules
SchedulesApi showSchedule GET /schedules/{id} Fetch a schedule
SchedulesApi showScheduleState GET /schedules/{id}/state Fetch the state of a schedule
SchedulesApi updateSchedule PATCH /schedules/{id} Update a schedule
StorageApi usageStoragePeakRecordingIndex GET /usage/storage/peak_recording Fetch peak recording storage
StreamSourcesApi createakamaiStreamSource POST /stream_sources/akamai Create an Akamai stream source
StreamSourcesApi deleteakamaiStreamSource DELETE /stream_sources/akamai/{id} Delete an Akamai stream source
StreamSourcesApi listAkamaiStreamSources GET /stream_sources/akamai Fetch all Akamai stream sources
StreamSourcesApi listStreamSources GET /stream_sources Fetch all stream sources
StreamSourcesApi showAkamaiStreamSource GET /stream_sources/akamai/{id} Fetch an Akamai stream source
StreamSourcesApi updateAkamaiStreamSource PATCH /stream_sources/akamai/{id} Update an Akamai stream source
StreamTargetsApi createCustomStreamTarget POST /stream_targets/custom Create a custom stream target
StreamTargetsApi createStreamTargetGeoblock POST /stream_targets/{stream_target_id}/geoblock Create geo-blocking for a Wowza stream target
StreamTargetsApi createStreamTargetProperty POST /stream_targets/{stream_target_id}/properties Configure a property for a stream target
StreamTargetsApi createStreamTargetTokenAuth POST /stream_targets/{stream_target_id}/token_auth Create token authorization for a Wowza stream target
StreamTargetsApi createUllStreamTarget POST /stream_targets/ull Create an ultra low latency stream target
StreamTargetsApi createWowzaStreamTarget POST /stream_targets/wowza Create a Wowza stream target
StreamTargetsApi deleteCustomStreamTarget DELETE /stream_targets/custom/{id} Delete a custom stream target
StreamTargetsApi deleteStreamTargetProperty DELETE /stream_targets/{stream_target_id}/properties/{id} Delete a stream target property
StreamTargetsApi deleteUllStreamTarget DELETE /stream_targets/ull/{id} Delete an ultra low latency stream target
StreamTargetsApi deleteWowzaStreamTarget DELETE /stream_targets/wowza/{id} Delete a Wowza stream target
StreamTargetsApi listCustomStreamTargets GET /stream_targets/custom Fetch all custom stream targets
StreamTargetsApi listStreamTargetProperties GET /stream_targets/{stream_target_id}/properties Fetch all properties of a stream target
StreamTargetsApi listStreamTargets GET /stream_targets Fetch all stream targets
StreamTargetsApi listUllStreamTargets GET /stream_targets/ull Fetch all ultra low latency stream targets
StreamTargetsApi listWowzaStreamTargets GET /stream_targets/wowza Fetch all Wowza stream targets
StreamTargetsApi regenerateConnectionCodeStreamTarget PUT /stream_targets/{id}/regenerate_connection_code Regenerate the connection code for any stream target
StreamTargetsApi showCustomStreamTarget GET /stream_targets/custom/{id} Fetch a custom stream target
StreamTargetsApi showStreamTargetGeoblock GET /stream_targets/{stream_target_id}/geoblock Fetch geo-blocking for a Wowza stream target
StreamTargetsApi showStreamTargetMetricsCurrent GET /stream_targets/{id}/metrics/current Fetch current health metrics for an active ultra low latency stream target
StreamTargetsApi showStreamTargetMetricsHistoric GET /stream_targets/{id}/metrics/historic Fetch historic health metrics for an ultra low latency stream target
StreamTargetsApi showStreamTargetProperty GET /stream_targets/{stream_target_id}/properties/{id} Fetch a property of a stream target
StreamTargetsApi showStreamTargetTokenAuth GET /stream_targets/{stream_target_id}/token_auth Fetch token authorization for a Wowza stream target
StreamTargetsApi showUllStreamTarget GET /stream_targets/ull/{id} Fetch an ultra low latency stream target
StreamTargetsApi showWowzaStreamTarget GET /stream_targets/wowza/{id} Fetch a Wowza stream target
StreamTargetsApi updateCustomStreamTarget PATCH /stream_targets/custom/{id} Update a custom stream target
StreamTargetsApi updateStreamTargetGeoblock PATCH /stream_targets/{stream_target_id}/geoblock Update geo-blocking for a Wowza stream target
StreamTargetsApi updateStreamTargetTokenAuth PATCH /stream_targets/{stream_target_id}/token_auth Update token authorization for a Wowza stream target
StreamTargetsApi updateUllStreamTarget PATCH /stream_targets/ull/{id} Update an ultra low latency stream target
StreamTargetsApi updateWowzaStreamTarget PATCH /stream_targets/wowza/{id} Update a Wowza stream target
TranscodersApi createTranscoder POST /transcoders Create a transcoder
TranscodersApi createTranscoderOutput POST /transcoders/{transcoder_id}/outputs Create an output
TranscodersApi createTranscoderOutputOutputStreamTarget POST /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets Create an output stream target
TranscodersApi createTranscoderProperty POST /transcoders/{transcoder_id}/properties Configure a property for a transcoder
TranscodersApi deleteTranscoder DELETE /transcoders/{id} Delete a transcoder
TranscodersApi deleteTranscoderOutput DELETE /transcoders/{transcoder_id}/outputs/{id} Delete an output
TranscodersApi deleteTranscoderOutputOutputStreamTarget DELETE /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets/{stream_target_id} Delete an output stream target
TranscodersApi deleteTranscoderProperty DELETE /transcoders/{transcoder_id}/properties/{id} Delete a transcoder's property
TranscodersApi disableAllStreamTargetsTranscoder PUT /transcoders/{id}/disable_all_stream_targets Disable a transcoder's stream targets
TranscodersApi disableTranscoderOutputOutputStreamTarget PUT /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets/{stream_target_id}/disable Disable an output stream target
TranscodersApi enableAllStreamTargetsTranscoder PUT /transcoders/{id}/enable_all_stream_targets Enable a transcoder's stream targets
TranscodersApi enableTranscoderOutputOutputStreamTarget PUT /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets/{stream_target_id}/enable Enable an output stream target
TranscodersApi indexUptimes GET /transcoders/{transcoder_id}/uptimes Fetch all uptime records for a transcoder
TranscodersApi listTranscoderOutputOutputStreamTargets GET /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets Fetch all output stream targets of an output of a transcoder
TranscodersApi listTranscoderOutputs GET /transcoders/{transcoder_id}/outputs Fetch all outputs of a transcoder
TranscodersApi listTranscoderProperties GET /transcoders/{transcoder_id}/properties Fetch a transcoder's properties
TranscodersApi listTranscoderRecordings GET /transcoders/{id}/recordings Fetch a transcoder's recordings
TranscodersApi listTranscoderSchedules GET /transcoders/{id}/schedules Fetch transcoder's schedules
TranscodersApi listTranscoders GET /transcoders Fetch all transcoders
TranscodersApi resetTranscoder PUT /transcoders/{id}/reset Reset a transcoder
TranscodersApi restartTranscoderOutputOutputStreamTarget PUT /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets/{stream_target_id}/restart Restart an output stream target
TranscodersApi showTranscoder GET /transcoders/{id} Fetch a transcoder
TranscodersApi showTranscoderOutput GET /transcoders/{transcoder_id}/outputs/{id} Fetch an output
TranscodersApi showTranscoderOutputOutputStreamTarget GET /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets/{stream_target_id} Fetch an output stream target
TranscodersApi showTranscoderProperty GET /transcoders/{transcoder_id}/properties/{id} Fetch a property for a transcoder
TranscodersApi showTranscoderState GET /transcoders/{id}/state Fetch the state and uptime ID of a transcoder
TranscodersApi showTranscoderStats GET /transcoders/{id}/stats Fetch statistics for a current transcoder
TranscodersApi showTranscoderThumbnailUrl GET /transcoders/{id}/thumbnail_url Fetch the thumbnail URL of a transcoder
TranscodersApi showUptime GET /transcoders/{transcoder_id}/uptimes/{id} Fetch an uptime record
TranscodersApi showUptimeMetricsCurrent GET /transcoders/{transcoder_id}/uptimes/{id}/metrics/current Fetch current stream health metrics for an active transcoder
TranscodersApi showUptimeMetricsHistoric GET /transcoders/{transcoder_id}/uptimes/{id}/metrics/historic Fetch historic stream health metrics for a transcoder
TranscodersApi startTranscoder PUT /transcoders/{id}/start Start a transcoder
TranscodersApi stopTranscoder PUT /transcoders/{id}/stop Stop a transcoder
TranscodersApi updateTranscoder PATCH /transcoders/{id} Update a transcoder
TranscodersApi updateTranscoderOutput PATCH /transcoders/{transcoder_id}/outputs/{id} Update an output
TranscodersApi updateTranscoderOutputOutputStreamTarget PATCH /transcoders/{transcoder_id}/outputs/{output_id}/output_stream_targets/{stream_target_id} Update an output stream target
ViewerDataApi showViewerDataStreamTarget GET /usage/viewer_data/stream_targets/{id} Fetch viewer data for a stream target

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

wsc-access-key

  • Type: API key, HMAC
  • API key parameter name: wsc-access-key
  • Location: HTTP header

wsc-api-key

  • Type: API key, HMAC
  • API key parameter name: wsc-api-key
  • Location: HTTP header

wsc-signature

  • Type: HMAC
  • API key parameter name: wsc-signature
  • Location: HTTP header

wsc-timestamp

  • Type: HMAC
  • API key parameter name: wsc-timestamp
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Contribute

For the moment, we're not accepting public contributions for the Wowza Streaming Cloud Java SDK. We may open the code up to contributions in the future. For now, relay your concerns and things you'd like to see added by emailing us at cloud-feedback@wowza.com.

Feedback

We welcome your feedback on the SDK, its documentation, and the experience of using it. For now, we have disabled GitHub issues for this repo. To provide feedback or address concerns, email us at cloud-feedback@wowza.com.

Support

For now, we have disabled GitHub issues for this repo. To request assistance with the SDK, open a support ticket with Wowza Support.

Code of conduct

Please adhere to the guidelines described in the license for this SDK.

License

This code is distributed under the BSD-3 License.

alt tag