Mux v1.9.0 Mux.Video.Uploads View Source

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

Link to this section Summary

Functions

Cancel a direct upload.

Create a new direct upload.

Retrieve a direct upload by ID.

List direct uploads.

Link to this section Functions

Cancel a direct upload.

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

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, direct_upload, _env} = Mux.Video.Uploads.cancel(client, "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM")
iex> direct_upload
%{"cors_origin" => "http://localhost:8080", "id" => "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM", "new_asset_settings" => %{"playback_policies" => ["public"]}, "status" => "cancelled", "timeout" => 3600, "url" => "https://storage.googleapis.com/video-storage-us-east1-uploads/OOTbA00CpWh6OgwV3asF00IvD2STk22UXM?Expires=1545157644&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=bloopblop"}

Create a new direct upload.

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

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> params = %{"new_asset_settings" => %{"playback_policies" => ["public"]}, "cors_origin" => "http://localhost:8080"}
iex> Mux.Video.Uploads.create(client, params)
{:ok, %{"cors_origin" => "http://localhost:8080", "id" => "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM", "new_asset_settings" => %{"playback_policies" => ["public"]}, "status" => "waiting", "timeout" => 3600, "url" => "https://storage.googleapis.com/video-storage-us-east1-uploads/OOTbA00CpWh6OgwV3asF00IvD2STk22UXM?Expires=1545157644&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=bloopblop"}, %Tesla.Env{__client__: nil, __module__: nil, body: %{"data" => %{"cors_origin" => "http://localhost:8080", "id" => "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM", "new_asset_settings" => %{"playback_policies" => ["public"]}, "status" => "waiting", "timeout" => 3600, "url" => "https://storage.googleapis.com/video-storage-us-east1-uploads/OOTbA00CpWh6OgwV3asF00IvD2STk22UXM?Expires=1545157644&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=bloopblop"}}, headers: [], method: nil, opts: [], query: [], status: 201, url: ""}}
Link to this function

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

View Source

Retrieve a direct upload by ID.

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

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, upload, _env} = Mux.Video.Uploads.get(client, "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM")
iex> upload
%{"cors_origin" => "http://localhost:8080", "id" => "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM", "new_asset_settings" => %{"playback_policies" => ["public"]}, "status" => "waiting", "timeout" => 3600, "url" => "https://storage.googleapis.com/video-storage-us-east1-uploads/OOTbA00CpWh6OgwV3asF00IvD2STk22UXM?Expires=1545157644&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=bloopblop"}
Link to this function

list(client, params \\ [])

View Source

List direct uploads.

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

Examples

iex> client = Mux.Base.new("my_token_id", "my_token_secret")
iex> {:ok, uploads, _env} = Mux.Video.Uploads.list(client)
iex> uploads
[%{"cors_origin" => "http://localhost:8080", "id" => "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM", "new_asset_settings" => %{"playback_policies" => ["public"]}, "status" => "waiting", "timeout" => 3600, "url" => "https://storage.googleapis.com/video-storage-us-east1-uploads/OOTbA00CpWh6OgwV3asF00IvD2STk22UXM?Expires=1545157644&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=bloopblop"}, %{"cors_origin" => "http://localhost:8080", "id" => "OOTbA00CpWh6OgwV3asF00IvD2STk22UXM", "new_asset_settings" => %{"playback_policies" => ["public"]}, "status" => "waiting", "timeout" => 3600, "url" => "https://storage.googleapis.com/video-storage-us-east1-uploads/OOTbA00CpWh6OgwV3asF00IvD2STk22UXM?Expires=1545157644&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=bloopblop"}]