Skip to content

muxinc/mux-java

Repository files navigation

mux-java

Maven Central | Mux Docs | Mux API Reference

PLEASE NOTE: This is an early build of the Mux Java SDK, as evidenced by its pre-1.0 status, but we're reasonably certain of its stability and usability against the Mux API. Documentation is currently best-effort, but it'll improve over time! Instead of contacting Mux Support, please file an issue on this repository or email Mux DevEx for assistance.

Usage With Webhooks

At this moment, this SDK is not suitable for parsing or modeling webhook payloads, due to some incompatibilities in our API spec and our SDK generation tooling. We are working on resolving these issues, but for now you should only use this SDK for Mux's REST APIs.

Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.

For more information, please visit https://docs.mux.com

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.mux</groupId>
  <artifactId>mux-sdk-java</artifactId>
  <version>0.16.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.mux:mux-sdk-java:0.16.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/mux-sdk-java-0.16.0.jar
  • target/lib/*.jar

Getting Started

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

// Import classes:
import com.mux.ApiClient;
import com.mux.ApiException;
import com.mux.Configuration;
import com.mux.auth.*;
import com.mux.models.*;
import com.mux.sdk.AssetsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.mux.com");
    
    // Configure HTTP basic authorization: accessToken
    HttpBasicAuth accessToken = (HttpBasicAuth) defaultClient.getAuthentication("accessToken");
    accessToken.setUsername("YOUR USERNAME");
    accessToken.setPassword("YOUR PASSWORD");

    AssetsApi apiInstance = new AssetsApi(defaultClient);
    CreateAssetRequest createAssetRequest = {"input":[{"url":"https://muxed.s3.amazonaws.com/leds.mp4"}],"playback_policy":["public"],"video_quality":"basic"}; // CreateAssetRequest | 
    try {
      AssetResponse result = apiInstance.createAsset(createAssetRequest)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AssetsApi#createAsset");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to https://api.mux.com

Class Method HTTP request Description
AssetsApi createAsset POST /video/v1/assets Create an asset
AssetsApi createAssetPlaybackId POST /video/v1/assets/{ASSET_ID}/playback-ids Create a playback ID
AssetsApi createAssetTrack POST /video/v1/assets/{ASSET_ID}/tracks Create an asset track
AssetsApi deleteAsset DELETE /video/v1/assets/{ASSET_ID} Delete an asset
AssetsApi deleteAssetPlaybackId DELETE /video/v1/assets/{ASSET_ID}/playback-ids/{PLAYBACK_ID} Delete a playback ID
AssetsApi deleteAssetTrack DELETE /video/v1/assets/{ASSET_ID}/tracks/{TRACK_ID} Delete an asset track
AssetsApi generateAssetTrackSubtitles POST /video/v1/assets/{ASSET_ID}/tracks/{TRACK_ID}/generate-subtitles Generate track subtitles
AssetsApi getAsset GET /video/v1/assets/{ASSET_ID} Retrieve an asset
AssetsApi getAssetInputInfo GET /video/v1/assets/{ASSET_ID}/input-info Retrieve asset input info
AssetsApi getAssetPlaybackId GET /video/v1/assets/{ASSET_ID}/playback-ids/{PLAYBACK_ID} Retrieve a playback ID
AssetsApi listAssets GET /video/v1/assets List assets
AssetsApi updateAsset PATCH /video/v1/assets/{ASSET_ID} Update an asset
AssetsApi updateAssetMasterAccess PUT /video/v1/assets/{ASSET_ID}/master-access Update master access
AssetsApi updateAssetMp4Support PUT /video/v1/assets/{ASSET_ID}/mp4-support Update MP4 support
DeliveryUsageApi listDeliveryUsage GET /video/v1/delivery-usage List Usage
DimensionsApi listDimensionValues GET /data/v1/dimensions/{DIMENSION_ID} Lists the values for a specific dimension
DimensionsApi listDimensions GET /data/v1/dimensions List Dimensions
DirectUploadsApi cancelDirectUpload PUT /video/v1/uploads/{UPLOAD_ID}/cancel Cancel a direct upload
DirectUploadsApi createDirectUpload POST /video/v1/uploads Create a new direct upload URL
DirectUploadsApi getDirectUpload GET /video/v1/uploads/{UPLOAD_ID} Retrieve a single direct upload's info
DirectUploadsApi listDirectUploads GET /video/v1/uploads List direct uploads
DrmConfigurationsApi getDrmConfiguration GET /video/v1/drm-configurations/{DRM_CONFIGURATION_ID} Retrieve a DRM Configuration
DrmConfigurationsApi listDrmConfigurations GET /video/v1/drm-configurations List DRM Configurations
ErrorsApi listErrors GET /data/v1/errors List Errors
ExportsApi listExports GET /data/v1/exports List property video view export links
ExportsApi listExportsViews GET /data/v1/exports/views List available property view exports
FiltersApi listFilterValues GET /data/v1/filters/{FILTER_ID} Lists values for a specific filter
FiltersApi listFilters GET /data/v1/filters List Filters
IncidentsApi getIncident GET /data/v1/incidents/{INCIDENT_ID} Get an Incident
IncidentsApi listIncidents GET /data/v1/incidents List Incidents
IncidentsApi listRelatedIncidents GET /data/v1/incidents/{INCIDENT_ID}/related List Related Incidents
LiveStreamsApi createLiveStream POST /video/v1/live-streams Create a live stream
LiveStreamsApi createLiveStreamPlaybackId POST /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids Create a live stream playback ID
LiveStreamsApi createLiveStreamSimulcastTarget POST /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets Create a live stream simulcast target
LiveStreamsApi deleteLiveStream DELETE /video/v1/live-streams/{LIVE_STREAM_ID} Delete a live stream
LiveStreamsApi deleteLiveStreamPlaybackId DELETE /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID} Delete a live stream playback ID
LiveStreamsApi deleteLiveStreamSimulcastTarget DELETE /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} Delete a live stream simulcast target
LiveStreamsApi disableLiveStream PUT /video/v1/live-streams/{LIVE_STREAM_ID}/disable Disable a live stream
LiveStreamsApi enableLiveStream PUT /video/v1/live-streams/{LIVE_STREAM_ID}/enable Enable a live stream
LiveStreamsApi getLiveStream GET /video/v1/live-streams/{LIVE_STREAM_ID} Retrieve a live stream
LiveStreamsApi getLiveStreamPlaybackId GET /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID} Retrieve a live stream playback ID
LiveStreamsApi getLiveStreamSimulcastTarget GET /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} Retrieve a live stream simulcast target
LiveStreamsApi listLiveStreams GET /video/v1/live-streams List live streams
LiveStreamsApi resetStreamKey POST /video/v1/live-streams/{LIVE_STREAM_ID}/reset-stream-key Reset a live stream's stream key
LiveStreamsApi signalLiveStreamComplete PUT /video/v1/live-streams/{LIVE_STREAM_ID}/complete Signal a live stream is finished
LiveStreamsApi updateLiveStream PATCH /video/v1/live-streams/{LIVE_STREAM_ID} Update a live stream
LiveStreamsApi updateLiveStreamEmbeddedSubtitles PUT /video/v1/live-streams/{LIVE_STREAM_ID}/embedded-subtitles Update a live stream's embedded subtitles
LiveStreamsApi updateLiveStreamGeneratedSubtitles PUT /video/v1/live-streams/{LIVE_STREAM_ID}/generated-subtitles Update a live stream's generated subtitles
MetricsApi getMetricTimeseriesData GET /data/v1/metrics/{METRIC_ID}/timeseries Get metric timeseries data
MetricsApi getOverallValues GET /data/v1/metrics/{METRIC_ID}/overall Get Overall values
MetricsApi listAllMetricValues GET /data/v1/metrics/comparison List all metric values
MetricsApi listBreakdownValues GET /data/v1/metrics/{METRIC_ID}/breakdown List breakdown values
MetricsApi listInsights GET /data/v1/metrics/{METRIC_ID}/insights List Insights
MonitoringApi getMonitoringBreakdown GET /data/v1/monitoring/metrics/{MONITORING_METRIC_ID}/breakdown Get Monitoring Breakdown
MonitoringApi getMonitoringBreakdownTimeseries GET /data/v1/monitoring/metrics/{MONITORING_METRIC_ID}/breakdown-timeseries Get Monitoring Breakdown Timeseries
MonitoringApi getMonitoringHistogramTimeseries GET /data/v1/monitoring/metrics/{MONITORING_HISTOGRAM_METRIC_ID}/histogram-timeseries Get Monitoring Histogram Timeseries
MonitoringApi getMonitoringTimeseries GET /data/v1/monitoring/metrics/{MONITORING_METRIC_ID}/timeseries Get Monitoring Timeseries
MonitoringApi listMonitoringDimensions GET /data/v1/monitoring/dimensions List Monitoring Dimensions
MonitoringApi listMonitoringMetrics GET /data/v1/monitoring/metrics List Monitoring Metrics
PlaybackIdApi getAssetOrLivestreamId GET /video/v1/playback-ids/{PLAYBACK_ID} Retrieve an asset or live stream ID
PlaybackRestrictionsApi createPlaybackRestriction POST /video/v1/playback-restrictions Create a Playback Restriction
PlaybackRestrictionsApi deletePlaybackRestriction DELETE /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID} Delete a Playback Restriction
PlaybackRestrictionsApi getPlaybackRestriction GET /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID} Retrieve a Playback Restriction
PlaybackRestrictionsApi listPlaybackRestrictions GET /video/v1/playback-restrictions List Playback Restrictions
PlaybackRestrictionsApi updateReferrerDomainRestriction PUT /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}/referrer Update the Referrer Playback Restriction
PlaybackRestrictionsApi updateUserAgentRestriction PUT /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}/user_agent Update the User Agent Restriction
RealTimeApi getRealtimeBreakdown GET /data/v1/realtime/metrics/{REALTIME_METRIC_ID}/breakdown Get Real-Time Breakdown
RealTimeApi getRealtimeHistogramTimeseries GET /data/v1/realtime/metrics/{REALTIME_HISTOGRAM_METRIC_ID}/histogram-timeseries Get Real-Time Histogram Timeseries
RealTimeApi getRealtimeTimeseries GET /data/v1/realtime/metrics/{REALTIME_METRIC_ID}/timeseries Get Real-Time Timeseries
RealTimeApi listRealtimeDimensions GET /data/v1/realtime/dimensions List Real-Time Dimensions
RealTimeApi listRealtimeMetrics GET /data/v1/realtime/metrics List Real-Time Metrics
SigningKeysApi createSigningKey POST /system/v1/signing-keys Create a signing key
SigningKeysApi deleteSigningKey DELETE /system/v1/signing-keys/{SIGNING_KEY_ID} Delete a signing key
SigningKeysApi getSigningKey GET /system/v1/signing-keys/{SIGNING_KEY_ID} Retrieve a signing key
SigningKeysApi listSigningKeys GET /system/v1/signing-keys List signing keys
SpacesApi createSpace POST /video/v1/spaces Create a space
SpacesApi createSpaceBroadcast POST /video/v1/spaces/{SPACE_ID}/broadcasts Create a space broadcast
SpacesApi deleteSpace DELETE /video/v1/spaces/{SPACE_ID} Delete a space
SpacesApi deleteSpaceBroadcast DELETE /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID} Delete a space broadcast
SpacesApi getSpace GET /video/v1/spaces/{SPACE_ID} Retrieve a space
SpacesApi getSpaceBroadcast GET /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID} Retrieve space broadcast
SpacesApi listSpaces GET /video/v1/spaces List spaces
SpacesApi startSpaceBroadcast POST /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID}/start Start a space broadcast
SpacesApi stopSpaceBroadcast POST /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID}/stop Stop a space broadcast
TranscriptionVocabulariesApi createTranscriptionVocabulary POST /video/v1/transcription-vocabularies Create a Transcription Vocabulary
TranscriptionVocabulariesApi deleteTranscriptionVocabulary DELETE /video/v1/transcription-vocabularies/{TRANSCRIPTION_VOCABULARY_ID} Delete a Transcription Vocabulary
TranscriptionVocabulariesApi getTranscriptionVocabulary GET /video/v1/transcription-vocabularies/{TRANSCRIPTION_VOCABULARY_ID} Retrieve a Transcription Vocabulary
TranscriptionVocabulariesApi listTranscriptionVocabularies GET /video/v1/transcription-vocabularies List Transcription Vocabularies
TranscriptionVocabulariesApi updateTranscriptionVocabulary PUT /video/v1/transcription-vocabularies/{TRANSCRIPTION_VOCABULARY_ID} Update a Transcription Vocabulary
UrlSigningKeysApi createUrlSigningKey POST /video/v1/signing-keys Create a URL signing key
UrlSigningKeysApi deleteUrlSigningKey DELETE /video/v1/signing-keys/{SIGNING_KEY_ID} Delete a URL signing key
UrlSigningKeysApi getUrlSigningKey GET /video/v1/signing-keys/{SIGNING_KEY_ID} Retrieve a URL signing key
UrlSigningKeysApi listUrlSigningKeys GET /video/v1/signing-keys List URL signing keys
VideoViewsApi getVideoView GET /data/v1/video-views/{VIDEO_VIEW_ID} Get a Video View
VideoViewsApi listVideoViews GET /data/v1/video-views List Video Views
WebInputsApi createWebInput POST /video/v1/web-inputs Create a new Web Input
WebInputsApi deleteWebInput DELETE /video/v1/web-inputs/{WEB_INPUT_ID} Delete a Web Input
WebInputsApi getWebInput GET /video/v1/web-inputs/{WEB_INPUT_ID} Retrieve a Web Input
WebInputsApi launchWebInput PUT /video/v1/web-inputs/{WEB_INPUT_ID}/launch Launch a Web Input
WebInputsApi listWebInputs GET /video/v1/web-inputs List Web Inputs
WebInputsApi reloadWebInput PUT /video/v1/web-inputs/{WEB_INPUT_ID}/reload Reload a Web Input
WebInputsApi shutdownWebInput PUT /video/v1/web-inputs/{WEB_INPUT_ID}/shutdown Shut down a Web Input
WebInputsApi updateWebInputUrl PUT /video/v1/web-inputs/{WEB_INPUT_ID}/url Update Web Input URL

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

accessToken

  • Type: HTTP basic authentication

Recommendation

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

Author

[email protected]