Mux v3.2.1 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.
Create a new playback ID.
Delete an asset.
Delete a playback ID.
Retrieve an asset by ID.
Retrieve a playback ID.
Retrieve the asset's input info.
List assets.
Updates an asset, allowing modifications to passthrough
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{method: nil, url: "", query: [], headers: [], body: %{"data" => %{"created_at" => "1521503163", "id" => "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "playback_ids" => [%{"id" => "CypWdvOIUrxjI7RlRAbVm01fGxFMO6wfH", "policy" => "public"}], "status" => "preparing"}}, status: 201, opts: [], __module__: nil, __client__: nil}}
Create a new 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.Assets.create_playback_id(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", %{policy: "public"})
iex> playback_id
%{"id" => "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE", "policy" => "public"}
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
Delete a playback ID.
Returns {:ok, "", %Telsa.Env{}}
.
Examples
iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {status, "", _env} = Mux.Video.Assets.delete_playback_id(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE")
iex> status
:ok
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"}]}
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.Assets.get_playback_id(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE")
iex> playback_id
%{"id" => "FRDDXsjcNgD013rx1M4CDunZ86xkq8A02hfF3b6XAa7iE", "policy" => "public"}
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"}}]
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"}]}]
Updates an asset, allowing modifications to passthrough
Returns a tuple such as `{:ok, asset, %Tesla.Env{}} ## Examples iex> client = Mux.Base.new("my_token_id", "my_token_secret") iex> {:ok, asset, _env} = Mux.Video.Assets.update(client, "00ecNLnqiG8v00TLqqeZ00uCE5wCAaO3kKc", %{passthrough: "updated_passthrough"}) 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", "passthrough" => "updated_passthrough", "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"}]}
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"}]}
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"}]}