Mux v3.1.0 Mux.Video.LiveStreams View Source

This module provides functions for managing live streams in Mux Video. API Documentation

Link to this section Summary

Functions

Create a new live stream. API Documentation

Disable a live stream is finished. API Documentation

Enable a live stream is finished. API Documentation

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. API Documentation

Updates a live stream's embedded subtitles

Link to this section Functions

Create a new live stream. API Documentation

Returns {:ok, live_stream, %Tesla.Env{}}.

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, live_stream, _env} = Mux.Video.LiveStreams.create(client, %{playback_policy: "public", new_asset_settings: %{playback_policy: "public"}})
iex> live_stream
%{"created_at" => "1557338261", "id" => "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "new_asset_settings" => %{"playback_policies" => ["public"]}, "playback_ids" => [%{"id" => "iOkfIGstt4u1eYdFcPKGTWKz75Acpv3w", "policy" => "public"}], "reconnect_window" => 60, "status" => "idle", "stream_key" => "54676b58-6b19-5acb-f5bf-3aa35222efc6"}
Link to this function

create_playback_id(client, live_stream_id, params)

View Source

Create a live stream playback ID. API Documentation

Returns a tuple such as {:ok, playback_ids, %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, playback_id, _env} = Mux.Video.LiveStreams.create_playback_id(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", %{policy: "public"})
iex> playback_id
%{"id" => "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE", "policy" => "public"}
Link to this function

create_simulcast_target(client, live_stream_id, params)

View Source

Create a live stream simulcast target. API Documentation

Returns a tuple such as {:ok, simulcast_target, %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, simulcast_target, _env} = Mux.Video.LiveStreams.create_simulcast_target(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", %{url: "rtmp://live.example.com/app", stream_key: "abcdefgh"})
iex> simulcast_target
%{"id" => "vuOfW021mz5QA500wYEQ9SeUYvuYnpFz011mqSvski5T8claN02JN9ve2g", "passthrough" => "Example 1", "stream_key" => "abcdefgh", "url" => "rtmp://live.example1.com/app"}
Link to this function

delete(client, live_stream_id)

View Source

Delete a live stream. API Documentation

Returns a tuple such as {:ok, "", %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {status, _data, _env} = Mux.Video.LiveStreams.delete(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY")
iex> status
:ok
Link to this function

delete_playback_id(client, live_stream_id, playback_id)

View Source

Delete a live stream playback ID. API Documentation

Returns a tuple such as {:ok, "", %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {status, _, _env} = Mux.Video.LiveStreams.delete_playback_id(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE")
iex> status
:ok
Link to this function

delete_simulcast_target(client, live_stream_id, simulcast_target_id)

View Source

Delete a live stream simulcast target. API Documentation

Returns a tuple such as {:ok, "", %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {status, _, _env} = Mux.Video.LiveStreams.delete_simulcast_target(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "vuOfW021mz5QA500wYEQ9SeUYvuYnpFz011mqSvski5T8claN02JN9ve2g")
iex> status
:ok
Link to this function

disable(client, live_stream_id)

View Source

Disable a live stream is finished. API Documentation

Returns a tuple such as {:ok, "", %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {status, _, _env} = Mux.Video.LiveStreams.disable(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY")
iex> status
:ok
Link to this function

enable(client, live_stream_id)

View Source

Enable a live stream is finished. API Documentation

Returns a tuple such as {:ok, "", %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {status, _, _env} = Mux.Video.LiveStreams.enable(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY")
iex> status
:ok
Link to this function

get(client, live_stream_id, options \\ [])

View Source

Retrieve a live stream by ID. API Documentation

Returns a tuple such as {:ok, live_stream, %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, live_stream, _env} = Mux.Video.LiveStreams.get(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY")
iex> live_stream
%{"created_at" => "1557338261", "id" => "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "new_asset_settings" => %{"playback_policies" => ["public"]}, "playback_ids" => [%{"id" => "iOkfIGstt4u1eYdFcPKGTWKz75Acpv3w", "policy" => "public"}], "reconnect_window" => 60, "status" => "idle", "stream_key" => "54676b58-6b19-5acb-f5bf-3aa35222efc6"}
Link to this function

get_playback_id(client, live_stream_id, playback_id)

View Source

Retrieve a playback ID.

Returns {:ok, playback_id, %Telsa.Env{}}.

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, playback_id, _env} = Mux.Video.LiveStreams.get_playback_id(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE")
iex> playback_id
%{"id" => "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE", "policy" => "public"}
Link to this function

get_simulcast_target(client, live_stream_id, simulcast_target_id)

View Source

Retrieve a live stream simulcast target. API Documentation

Returns a tuple such as {:ok, simulcast_target, %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, simulcast_target, _env} = Mux.Video.LiveStreams.get_simulcast_target(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "vuOfW021mz5QA500wYEQ9SeUYvuYnpFz011mqSvski5T8claN02JN9ve2g")
iex> simulcast_target
%{"id" => "vuOfW021mz5QA500wYEQ9SeUYvuYnpFz011mqSvski5T8claN02JN9ve2g", "passthrough" => "Example 1", "stream_key" => "abcdefgh", "url" => "rtmp://live.example1.com/app"}
Link to this function

list(client, params \\ [])

View Source

List all live streams. API Documentation

Returns a tuple such as {:ok, live_streams, %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, live_streams, _env} = Mux.Video.LiveStreams.list(client)
iex> live_streams
[%{"created_at" => "1557338261", "id" => "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "new_asset_settings" => %{"playback_policies" => ["public"]}, "playback_ids" => [%{"id" => "iOkfIGstt4u1eYdFcPKGTWKz75Acpv3w", "policy" => "public"}], "reconnect_window" => 60, "status" => "idle", "stream_key" => "54676b58-6b19-5acb-f5bf-3aa35222efc6"}, %{"created_at" => "1557338261", "id" => "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "new_asset_settings" => %{"playback_policies" => ["public"]}, "playback_ids" => [%{"id" => "iOkfIGstt4u1eYdFcPKGTWKz75Acpv3w", "policy" => "public"}], "reconnect_window" => 60, "status" => "idle", "stream_key" => "54676b58-6b19-5acb-f5bf-3aa35222efc6"}]
Link to this function

reset_stream_key(client, live_stream_id)

View Source

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. API Documentation

Returns a tuple such as {:ok, "", %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, live_stream, _env} = Mux.Video.LiveStreams.reset_stream_key(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY")
iex> live_stream
%{"created_at" => "1557338261", "id" => "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "new_asset_settings" => %{"playback_policies" => ["public"]}, "playback_ids" => [%{"id" => "iOkfIGstt4u1eYdFcPKGTWKz75Acpv3w", "policy" => "public"}], "reconnect_window" => 60, "status" => "idle", "stream_key" => "54676b58-6b19-5acb-f5bf-3aa35222efc6"}
Link to this function

signal_complete(client, live_stream_id)

View Source

Signal a live stream is finished. API Documentation

Returns a tuple such as {:ok, "", %Tesla.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {status, _, _env} = Mux.Video.LiveStreams.signal_complete(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY")
iex> status
:ok
Link to this function

update(client, live_stream_id, params)

View Source

Updates a live stream. See https://docs.mux.com/api-reference/video#operation/update-live-stream for the values that are allowed.

Returns a tuple such as `{:ok, live_stream, %Tesla.Env{}} ## Examples iex> client = Mux.Base.new("my_token_id", "my_token_secret") iex> {:ok, live_stream, _env} = Mux.Video.LiveStreams.update(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", %{passthrough: "updated_passthrough", latency_mode: "low", max_continuous_duration: 21600, reconnect_window: 30}) iex> live_stream %{"created_at" => "1557338261", "id" => "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "latency_mode" => "low", "max_continuous_duration" => 21600, "new_asset_settings" => %{"playback_policies" => ["public"]}, "passthrough" => "updated_passthrough", "playback_ids" => [%{"id" => "iOkfIGstt4u1eYdFcPKGTWKz75Acpv3w", "policy" => "public"}], "reconnect_window" => 30, "status" => "idle", "stream_key" => "54676b58-6b19-5acb-f5bf-3aa35222efc6"}

Link to this function

update_embedded_subtitles(client, live_stream_id, params)

View Source

Updates a live stream's embedded subtitles

Returns a tuple such as `{:ok, live_stream, %Tesla.Env{}} ## Examples iex> client = Mux.Base.new("my_token_id", "my_token_secret") iex> {:ok, live_stream, _env} = Mux.Video.LiveStreams.update_embedded_subtitles(client, "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", %{embedded_subtitles: %{name: "English CC", passthrough: "Example", language_code: "en", language_channel: "cc1"}}) iex> live_stream %{"created_at" => "1557338261", "embedded_subtitles" => %{"language_channel" => "cc1", "language_code" => "en", "name" => "English CC", "passthrough" => "Example"}, "id" => "aA02skpHXoLrbQm49qIzAG6RtewFOcDEY", "new_asset_settings" => %{"playback_policies" => ["public"]}, "playback_ids" => [%{"id" => "iOkfIGstt4u1eYdFcPKGTWKz75Acpv3w", "policy" => "public"}], "reconnect_window" => 60, "status" => "idle", "stream_key" => "54676b58-6b19-5acb-f5bf-3aa35222efc6"}