Skip to content

Latest commit

 

History

History
1223 lines (947 loc) · 43.6 KB

LiveStreamsApi.md

File metadata and controls

1223 lines (947 loc) · 43.6 KB

LiveStreamsApi

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

Method HTTP request Description
createLiveStream POST /video/v1/live-streams Create a live stream
createLiveStreamPlaybackId POST /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids Create a live stream playback ID
createLiveStreamSimulcastTarget POST /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets Create a live stream simulcast target
deleteLiveStream DELETE /video/v1/live-streams/{LIVE_STREAM_ID} Delete a live stream
deleteLiveStreamPlaybackId DELETE /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID} Delete a live stream playback ID
deleteLiveStreamSimulcastTarget DELETE /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} Delete a live stream simulcast target
disableLiveStream PUT /video/v1/live-streams/{LIVE_STREAM_ID}/disable Disable a live stream
enableLiveStream PUT /video/v1/live-streams/{LIVE_STREAM_ID}/enable Enable a live stream
getLiveStream GET /video/v1/live-streams/{LIVE_STREAM_ID} Retrieve a live stream
getLiveStreamPlaybackId GET /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID} Retrieve a live stream playback ID
getLiveStreamSimulcastTarget GET /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} Retrieve a live stream simulcast target
listLiveStreams GET /video/v1/live-streams List live streams
resetStreamKey POST /video/v1/live-streams/{LIVE_STREAM_ID}/reset-stream-key Reset a live stream's stream key
signalLiveStreamComplete PUT /video/v1/live-streams/{LIVE_STREAM_ID}/complete Signal a live stream is finished
updateLiveStream PATCH /video/v1/live-streams/{LIVE_STREAM_ID} Update a live stream
updateLiveStreamEmbeddedSubtitles PUT /video/v1/live-streams/{LIVE_STREAM_ID}/embedded-subtitles Update a live stream's embedded subtitles
updateLiveStreamGeneratedSubtitles PUT /video/v1/live-streams/{LIVE_STREAM_ID}/generated-subtitles Update a live stream's generated subtitles

createLiveStream

LiveStreamResponse createLiveStream(createLiveStreamRequest).execute();

Create a live stream

Creates a new live stream. Once created, an encoder can connect to Mux via the specified stream key and begin streaming to an audience.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    CreateLiveStreamRequest createLiveStreamRequest = {"playback_policy":["public"],"new_asset_settings":{"playback_policy":["public"]}}; // CreateLiveStreamRequest | 
    try {
      LiveStreamResponse result = apiInstance.createLiveStream(createLiveStreamRequest)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#createLiveStream");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
createLiveStreamRequest CreateLiveStreamRequest

Return type

LiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -

createLiveStreamPlaybackId

CreatePlaybackIDResponse createLiveStreamPlaybackId(LIVE_STREAM_ID, createPlaybackIDRequest).execute();

Create a live stream playback ID

Create a new playback ID for this live stream, through which a viewer can watch the streamed content of the live stream.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    CreatePlaybackIDRequest createPlaybackIDRequest = {"policy":"signed"}; // CreatePlaybackIDRequest | 
    try {
      CreatePlaybackIDResponse result = apiInstance.createLiveStreamPlaybackId(LIVE_STREAM_ID, createPlaybackIDRequest)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#createLiveStreamPlaybackId");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
createPlaybackIDRequest CreatePlaybackIDRequest

Return type

CreatePlaybackIDResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -

createLiveStreamSimulcastTarget

SimulcastTargetResponse createLiveStreamSimulcastTarget(LIVE_STREAM_ID, createSimulcastTargetRequest).execute();

Create a live stream simulcast target

Create a simulcast target for the parent live stream. Simulcast target can only be created when the parent live stream is in idle state. Only one simulcast target can be created at a time with this API.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    CreateSimulcastTargetRequest createSimulcastTargetRequest = {"url":"rtmp://live.example.com/app","stream_key":"abcdefgh","passthrough":"Example"}; // CreateSimulcastTargetRequest | 
    try {
      SimulcastTargetResponse result = apiInstance.createLiveStreamSimulcastTarget(LIVE_STREAM_ID, createSimulcastTargetRequest)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#createLiveStreamSimulcastTarget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
createSimulcastTargetRequest CreateSimulcastTargetRequest

Return type

SimulcastTargetResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -

deleteLiveStream

deleteLiveStream(LIVE_STREAM_ID).execute();

Delete a live stream

Deletes a live stream from the current environment. If the live stream is currently active and being streamed to, ingest will be terminated and the encoder will be disconnected.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    try {
      apiInstance.deleteLiveStream(LIVE_STREAM_ID)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#deleteLiveStream");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID

Return type

null (empty response body)

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 No Content -

deleteLiveStreamPlaybackId

deleteLiveStreamPlaybackId(LIVE_STREAM_ID, PLAYBACK_ID).execute();

Delete a live stream playback ID

Deletes the playback ID for the live stream. This will not disable ingest (as the live stream still exists). New attempts to play back the live stream will fail immediately. However, current viewers will be able to continue watching the stream for some period of time.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    String PLAYBACK_ID = "PLAYBACK_ID_example"; // String | The live stream's playback ID.
    try {
      apiInstance.deleteLiveStreamPlaybackId(LIVE_STREAM_ID, PLAYBACK_ID)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#deleteLiveStreamPlaybackId");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
PLAYBACK_ID String The live stream's playback ID.

Return type

null (empty response body)

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 No Content -

deleteLiveStreamSimulcastTarget

deleteLiveStreamSimulcastTarget(LIVE_STREAM_ID, SIMULCAST_TARGET_ID).execute();

Delete a live stream simulcast target

Delete the simulcast target using the simulcast target ID returned when creating the simulcast target. Simulcast Target can only be deleted when the parent live stream is in idle state.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    String SIMULCAST_TARGET_ID = "SIMULCAST_TARGET_ID_example"; // String | The ID of the simulcast target.
    try {
      apiInstance.deleteLiveStreamSimulcastTarget(LIVE_STREAM_ID, SIMULCAST_TARGET_ID)
            .execute();
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#deleteLiveStreamSimulcastTarget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
SIMULCAST_TARGET_ID String The ID of the simulcast target.

Return type

null (empty response body)

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 No Content -

disableLiveStream

DisableLiveStreamResponse disableLiveStream(LIVE_STREAM_ID).execute();

Disable a live stream

Disables a live stream, making it reject incoming RTMP streams until re-enabled. The API also ends the live stream recording immediately when active. Ending the live stream recording adds the `EXT-X-ENDLIST` tag to the HLS manifest which notifies the player that this live stream is over. Mux also closes the encoder connection immediately. Any attempt from the encoder to re-establish connection will fail till the live stream is re-enabled.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    try {
      DisableLiveStreamResponse result = apiInstance.disableLiveStream(LIVE_STREAM_ID)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#disableLiveStream");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID

Return type

DisableLiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

enableLiveStream

EnableLiveStreamResponse enableLiveStream(LIVE_STREAM_ID).execute();

Enable a live stream

Enables a live stream, allowing it to accept an incoming RTMP stream.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    try {
      EnableLiveStreamResponse result = apiInstance.enableLiveStream(LIVE_STREAM_ID)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#enableLiveStream");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID

Return type

EnableLiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getLiveStream

LiveStreamResponse getLiveStream(LIVE_STREAM_ID).execute();

Retrieve a live stream

Retrieves the details of a live stream that has previously been created. Supply the unique live stream ID that was returned from your previous request, and Mux will return the corresponding live stream information. The same information is returned when creating a live stream.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    try {
      LiveStreamResponse result = apiInstance.getLiveStream(LIVE_STREAM_ID)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#getLiveStream");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID

Return type

LiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getLiveStreamPlaybackId

GetLiveStreamPlaybackIDResponse getLiveStreamPlaybackId(LIVE_STREAM_ID, PLAYBACK_ID).execute();

Retrieve a live stream playback ID

Fetches information about a live stream's playback ID, through which a viewer can watch the streamed content from this live stream.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    String PLAYBACK_ID = "PLAYBACK_ID_example"; // String | The live stream's playback ID.
    try {
      GetLiveStreamPlaybackIDResponse result = apiInstance.getLiveStreamPlaybackId(LIVE_STREAM_ID, PLAYBACK_ID)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#getLiveStreamPlaybackId");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
PLAYBACK_ID String The live stream's playback ID.

Return type

GetLiveStreamPlaybackIDResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getLiveStreamSimulcastTarget

SimulcastTargetResponse getLiveStreamSimulcastTarget(LIVE_STREAM_ID, SIMULCAST_TARGET_ID).execute();

Retrieve a live stream simulcast target

Retrieves the details of the simulcast target created for the parent live stream. Supply the unique live stream ID and simulcast target ID that was returned in the response of create simulcast target request, and Mux will return the corresponding information.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    String SIMULCAST_TARGET_ID = "SIMULCAST_TARGET_ID_example"; // String | The ID of the simulcast target.
    try {
      SimulcastTargetResponse result = apiInstance.getLiveStreamSimulcastTarget(LIVE_STREAM_ID, SIMULCAST_TARGET_ID)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#getLiveStreamSimulcastTarget");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
SIMULCAST_TARGET_ID String The ID of the simulcast target.

Return type

SimulcastTargetResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

listLiveStreams

ListLiveStreamsResponse listLiveStreams().limit(limit).page(page).streamKey(streamKey).status(status).execute();

List live streams

Lists the live streams that currently exist in the current environment.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    Integer limit = 25; // Integer | Number of items to include in the response
    Integer page = 1; // Integer | Offset by this many pages, of the size of `limit`
    String streamKey = "streamKey_example"; // String | Filter response to return live stream for this stream key only
    LiveStreamStatus status = LiveStreamStatus.fromValue("active"); // LiveStreamStatus | Filter response to return live streams with the specified status only
    try {
      ListLiveStreamsResponse result = apiInstance.listLiveStreams()
            .limit(limit)
            .page(page)
            .streamKey(streamKey)
            .status(status)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#listLiveStreams");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
limit Integer Number of items to include in the response [optional] [default to 25]
page Integer Offset by this many pages, of the size of `limit` [optional] [default to 1]
streamKey String Filter response to return live stream for this stream key only [optional]
status LiveStreamStatus Filter response to return live streams with the specified status only [optional] [enum: active, idle, disabled]

Return type

ListLiveStreamsResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

resetStreamKey

LiveStreamResponse resetStreamKey(LIVE_STREAM_ID).execute();

Reset a live stream's stream key

Reset a live stream key if you want to immediately stop the current stream key from working and create a new stream key that can be used for future broadcasts.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    try {
      LiveStreamResponse result = apiInstance.resetStreamKey(LIVE_STREAM_ID)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#resetStreamKey");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID

Return type

LiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 OK -

signalLiveStreamComplete

SignalLiveStreamCompleteResponse signalLiveStreamComplete(LIVE_STREAM_ID).execute();

Signal a live stream is finished

(Optional) End the live stream recording immediately instead of waiting for the reconnect_window. `EXT-X-ENDLIST` tag is added to the HLS manifest which notifies the player that this live stream is over. Mux does not close the encoder connection immediately. Encoders are often configured to re-establish connections immediately which would result in a new recorded asset. For this reason, Mux waits for 60s before closing the connection with the encoder. This 60s timeframe is meant to give encoder operators a chance to disconnect from their end.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    try {
      SignalLiveStreamCompleteResponse result = apiInstance.signalLiveStreamComplete(LIVE_STREAM_ID)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#signalLiveStreamComplete");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID

Return type

SignalLiveStreamCompleteResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

updateLiveStream

LiveStreamResponse updateLiveStream(LIVE_STREAM_ID, updateLiveStreamRequest).execute();

Update a live stream

Updates the parameters of a previously-created live stream. This currently supports a subset of variables. Supply the live stream ID and the updated parameters and Mux will return the corresponding live stream information. The information returned will be the same after update as for subsequent get live stream requests.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    UpdateLiveStreamRequest updateLiveStreamRequest = {"latency_mode":"standard","reconnect_window":30,"max_continuous_duration":1200}; // UpdateLiveStreamRequest | 
    try {
      LiveStreamResponse result = apiInstance.updateLiveStream(LIVE_STREAM_ID, updateLiveStreamRequest)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#updateLiveStream");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
updateLiveStreamRequest UpdateLiveStreamRequest

Return type

LiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

updateLiveStreamEmbeddedSubtitles

LiveStreamResponse updateLiveStreamEmbeddedSubtitles(LIVE_STREAM_ID, updateLiveStreamEmbeddedSubtitlesRequest).execute();

Update a live stream's embedded subtitles

Configures a live stream to receive embedded closed captions. The resulting Asset's subtitle text track will have `closed_captions: true` set.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    UpdateLiveStreamEmbeddedSubtitlesRequest updateLiveStreamEmbeddedSubtitlesRequest = {"embedded_subtitles":[{"passthrough":"Example"}]}; // UpdateLiveStreamEmbeddedSubtitlesRequest | 
    try {
      LiveStreamResponse result = apiInstance.updateLiveStreamEmbeddedSubtitles(LIVE_STREAM_ID, updateLiveStreamEmbeddedSubtitlesRequest)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#updateLiveStreamEmbeddedSubtitles");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
updateLiveStreamEmbeddedSubtitlesRequest UpdateLiveStreamEmbeddedSubtitlesRequest

Return type

LiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

updateLiveStreamGeneratedSubtitles

LiveStreamResponse updateLiveStreamGeneratedSubtitles(LIVE_STREAM_ID, updateLiveStreamGeneratedSubtitlesRequest).execute();

Update a live stream's generated subtitles

Updates a live stream's automatic-speech-recognition-generated subtitle configuration. Automatic speech recognition subtitles can be removed by sending an empty array in the request payload.

Example

// 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.LiveStreamsApi;

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");

    LiveStreamsApi apiInstance = new LiveStreamsApi(defaultClient);
    String LIVE_STREAM_ID = "LIVE_STREAM_ID_example"; // String | The live stream ID
    UpdateLiveStreamGeneratedSubtitlesRequest updateLiveStreamGeneratedSubtitlesRequest = {"generated_subtitles":[{"name":"English CC (ASR)","language_code":"en","passthrough":"Example"}]}; // UpdateLiveStreamGeneratedSubtitlesRequest | 
    try {
      LiveStreamResponse result = apiInstance.updateLiveStreamGeneratedSubtitles(LIVE_STREAM_ID, updateLiveStreamGeneratedSubtitlesRequest)
            .execute();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LiveStreamsApi#updateLiveStreamGeneratedSubtitles");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
LIVE_STREAM_ID String The live stream ID
updateLiveStreamGeneratedSubtitlesRequest UpdateLiveStreamGeneratedSubtitlesRequest

Return type

LiveStreamResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -