LiveStreams
Extends:
Live Streams Class - Provides access to the Mux Video Live Streams API
Example:
const muxClient = new Mux(accessToken, secret);
const { Video } = muxClient;
// Create a live stream
Video.LiveStreams.create({
playback_policy: 'public',
new_asset_settings: { playback_policy: 'public' }
});
Method Summary
Public Methods | ||
public |
Creates a Mux live stream with the specified JSON parameters |
|
public |
createPlaybackId(liveStreamId: string, params: Object): Promise Create a live stream playback id |
|
public |
createSimulcastTarget(liveStreamId: string, params: Object): Promise Create a simulcast target |
|
public |
Deletes a Mux Live Stream |
|
public |
deletePlaybackId(liveStreamId: string, playbackId: string): Promise Delete a live stream playback ID |
|
public |
deleteSimulcastTarget(liveStreamId: string, simulcastTargetId: string): Promise Delete a simulcast target |
|
public |
Disable a Live Stream |
|
public |
Enable a Live Stream |
|
public |
Get an Live Stream |
|
public |
getSimulcastTarget(liveStreamId: string, simulcastTargetId: string): Promise Get a simulcast target |
|
public |
List all live streams for a Mux Environment (tied to your access token) |
|
public |
resetStreamKey(liveStreamId: string): Promise Reset a stream key |
|
public |
signalComplete(liveStreamId: string): Promise Signal a live stream is finished |
Public Methods
public create(params: Object): Promise source
Creates a Mux live stream with the specified JSON parameters
Params:
Name | Type | Attribute | Description |
params | Object | Live Stream JSON parameters (e.g playback_policy) |
Example:
const muxClient = new Mux(accessToken, secret);
const { Video } = muxClient;
// Create a live stream
Video.LiveStreams.create({
playback_policy: 'public',
new_asset_settings: { playback_policy: 'public' }
});
public createPlaybackId(liveStreamId: string, params: Object): Promise source
Create a live stream playback id
Example:
const { Video } = new Mux(accessToken, secret);
// Create a live stream playback ID
Video.LiveStreams.createPlaybackId(liveStreamId, { policy: 'public' });
Test:
public createSimulcastTarget(liveStreamId: string, params: Object): Promise source
Create a simulcast target
Example:
const { Video } = new Mux(accessToken, secret);
// Create a live simulcast target
Video.LiveStreams.createSimulcastTarget(liveStreamId, {url: 'rtmp://live.example.com/app', stream_key: 'difvbfgi', passthrough: 'Example Live Streaming service'});
Test:
public del(liveStreamId: string): Promise source
Deletes a Mux Live Stream
Params:
Name | Type | Attribute | Description |
liveStreamId | string | The ID for the live stream intended for deletion |
Example:
const { Video } = new Mux(accessToken, secret);
// Delete a mux live stream
Video.LiveStreams.del(liveStreamId);
Test:
public deletePlaybackId(liveStreamId: string, playbackId: string): Promise source
Delete a live stream playback ID
Example:
const { Video } = new Mux(accessToken, secret);
// Delete a live stream playback ID
Video.LiveStreams.deletePlaybackId(liveStreamId, { policy: 'public' });
Test:
public deleteSimulcastTarget(liveStreamId: string, simulcastTargetId: string): Promise source
Delete a simulcast target
Example:
const { Video } = new Mux(accessToken, secret);
// Delete a simulcast target
Video.LiveStreams.deleteSimulcastTarget(liveStreamId, simulcastTargetId);
Test:
public disable(liveStreamId: string): Promise source
Disable a Live Stream
Params:
Name | Type | Attribute | Description |
liveStreamId | string | The ID for the live stream |
Example:
const { Video } = new Mux(accessToken, secret);
// Disable a live stream
Video.LiveStreams.disable(liveStreamId);
Test:
public enable(liveStreamId: string): Promise source
Enable a Live Stream
Params:
Name | Type | Attribute | Description |
liveStreamId | string | The ID for the live stream |
Example:
const { Video } = new Mux(accessToken, secret);
// Enable a Live Stream
Video.LiveStreams.enable(liveStreamId);
Test:
public get(liveStreamId: string): Promise source
Get an Live Stream
Params:
Name | Type | Attribute | Description |
liveStreamId | string | The ID for the live stream |
Example:
const { Video } = new Mux(accessToken, secret);
// Get a live stream
Video.LiveStreams.get(liveStreamId);
Test:
public getSimulcastTarget(liveStreamId: string, simulcastTargetId: string): Promise source
Get a simulcast target
Example:
const { Video } = new Mux(accessToken, secret);
// Get a live simulcast target
Video.LiveStreams.getSimulcastTarget(liveStreamId, simulcastTargetId);
Test:
public list(params: *): Promise source
List all live streams for a Mux Environment (tied to your access token)
Params:
Name | Type | Attribute | Description |
params | * |
Example:
const { Video } = new Mux(accessToken, secret);
// List all live streams for a Mux Environment
Video.LiveStreams.list();
Test:
public resetStreamKey(liveStreamId: string): Promise source
Reset a stream key
Params:
Name | Type | Attribute | Description |
liveStreamId | string | The ID for the live stream |
Example:
const { Video } = new Mux(accessToken, secret);
// 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.
Video.LiveStreams.resetStreamKey(liveStreamId);
Test:
public signalComplete(liveStreamId: string): Promise source
Signal a live stream is finished
Params:
Name | Type | Attribute | Description |
liveStreamId | string | The ID for the live stream |
Example:
const { Video } = new Mux(accessToken, secret);
// Signal a live stream is finished
Video.LiveStreams.signalComplete(liveStreamId);