Mux v1.9.0 Mux.Video.Assets View Source

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

Link to this section Summary

Functions

Create a new asset.

Retrieve an asset by ID.

Retrieve the asset's input info.

Updates an asset's master access

Updates an asset's mp4 support

Link to this section Functions

Create a new asset.

Returns {:ok, asset, %Tesla.Client{}}.

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> Mux.Video.Assets.create(client, %{input: "https://example.com/video.mp4"})
{:ok, %{"created_at" => "1521503163", "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "preparing"}, %Tesla.Env{__client__: nil, __module__: nil, body: %{"data" => %{"created_at" => "1521503163", "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "preparing"}}, headers: [], method: nil, opts: [], query: [], status: 201, url: ""}}
Link to this function

delete(client, asset_id, params \\ [])

View Source

Delete an asset.

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

Examples

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

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

View Source

Retrieve an asset by ID.

Returns a tuple such as {:ok, asset, %Telsa.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, asset, _env} = Mux.Video.Assets.get(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc")
iex> asset
%{"aspect_ratio" => "16:9", "created_at" => "1521503163", "duration" => 23.872, "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "master_access" => "none", "max_stored_frame_rate" => 29.97, "max_stored_resolution" => "HD", "mp4_support" => "none", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "ready", "tracks" => [%{"duration" => 23.8238, "id" => "7wVkNSIVRAIKB1oj6jezHK1BATAXuwy3", "max_frame_rate" => 29.97, "max_height" => 1080, "max_width" => 1920, "type" => "video"}, %{"duration" => 23.872, "id" => "PnA02RYkGox02I01NDr02yAzp5qqAiOS401VgQO1pg00gByzk", "max_channel_layout" => "stereo", "max_channels" => 2, "type" => "audio"}]}
Link to this function

input_info(client, asset_id, params \\ [])

View Source

Retrieve the asset's input info.

Returns a tuple such as {:ok, input_info, %Telsa.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, input_info, _env} = Mux.Video.Assets.input_info(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc")
iex> input_info
[%{"file" => %{"container_format" => "mov,mp4,m4a,3gp,3g2,mj2", "tracks" => [%{"duration" => 23.8238, "encoding" => "h264", "frame_rate" => 29.97, "height" => 1080, "type" => "video", "width" => 1920}, %{"channels" => 2, "duration" => 23.872, "encoding" => "aac", "sample_rate" => 48000, "type" => "audio"}]}, "settings" => %{"url" => "https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4"}}]
Link to this function

list(client, params \\ [])

View Source

List assets.

Returns a tuple such as {:ok, assets, %Telsa.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, assets, _env} = Mux.Video.Assets.list(client)
iex> assets
[%{"aspect_ratio" => "16:9", "created_at" => "1521503163", "duration" => 23.872, "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "master_access" => "none", "max_stored_frame_rate" => 29.97, "max_stored_resolution" => "HD", "mp4_support" => "none", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "ready", "tracks" => [%{"duration" => 23.8238, "id" => "7wVkNSIVRAIKB1oj6jezHK1BATAXuwy3", "max_frame_rate" => 29.97, "max_height" => 1080, "max_width" => 1920, "type" => "video"}, %{"duration" => 23.872, "id" => "PnA02RYkGox02I01NDr02yAzp5qqAiOS401VgQO1pg00gByzk", "max_channel_layout" => "stereo", "max_channels" => 2, "type" => "audio"}]}, %{"aspect_ratio" => "16:9", "created_at" => "1521503163", "duration" => 23.872, "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "master_access" => "none", "max_stored_frame_rate" => 29.97, "max_stored_resolution" => "HD", "mp4_support" => "none", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "ready", "tracks" => [%{"duration" => 23.8238, "id" => "7wVkNSIVRAIKB1oj6jezHK1BATAXuwy3", "max_frame_rate" => 29.97, "max_height" => 1080, "max_width" => 1920, "type" => "video"}, %{"duration" => 23.872, "id" => "PnA02RYkGox02I01NDr02yAzp5qqAiOS401VgQO1pg00gByzk", "max_channel_layout" => "stereo", "max_channels" => 2, "type" => "audio"}]}]
Link to this function

update_master_access(client, asset_id, params)

View Source

Updates an asset's master access

Returns a tuple such as {:ok, asset, %Telsa.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, asset, _env} = Mux.Video.Assets.update_master_access(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", %{master_access: "temporary"})
iex> asset
%{"aspect_ratio" => "16:9", "created_at" => "1521503163", "duration" => 23.872, "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "master_access" => "none", "max_stored_frame_rate" => 29.97, "max_stored_resolution" => "HD", "mp4_support" => "none", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "ready", "tracks" => [%{"duration" => 23.8238, "id" => "7wVkNSIVRAIKB1oj6jezHK1BATAXuwy3", "max_frame_rate" => 29.97, "max_height" => 1080, "max_width" => 1920, "type" => "video"}, %{"duration" => 23.872, "id" => "PnA02RYkGox02I01NDr02yAzp5qqAiOS401VgQO1pg00gByzk", "max_channel_layout" => "stereo", "max_channels" => 2, "type" => "audio"}]}
Link to this function

update_mp4_support(client, asset_id, params)

View Source

Updates an asset's mp4 support

Returns a tuple such as {:ok, asset, %Telsa.Env{}}

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, asset, _env} = Mux.Video.Assets.update_mp4_support(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", %{mp4_support: "standard"})
iex> asset
%{"aspect_ratio" => "16:9", "created_at" => "1521503163", "duration" => 23.872, "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "master_access" => "none", "max_stored_frame_rate" => 29.97, "max_stored_resolution" => "HD", "mp4_support" => "none", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "ready", "tracks" => [%{"duration" => 23.8238, "id" => "7wVkNSIVRAIKB1oj6jezHK1BATAXuwy3", "max_frame_rate" => 29.97, "max_height" => 1080, "max_width" => 1920, "type" => "video"}, %{"duration" => 23.872, "id" => "PnA02RYkGox02I01NDr02yAzp5qqAiOS401VgQO1pg00gByzk", "max_channel_layout" => "stereo", "max_channels" => 2, "type" => "audio"}]}