Use our API and components to handle embedding, storing, and streaming video in your Elixir application
Add mux
to your list of dependencies in mix.exs
.
def deps do
[
{:mux, "~> 3.2.1"}
]
end
To start, we'll need a Mux access token. We'll put our access token in our application configuration.
# config/dev.exs
config :mux,
access_token_id: "abcd1234",
access_token_secret: "efghijkl"
Then use this config to initialize a new client in your application.
client = Mux.client()
You can also pass the access token ID and secret directly to client/2 function if you'd prefer:
client = Mux.client("access_token_id", "access_token_secret")
Now we can use the client to upload new videos, manage playback IDs, etc.
params = %{
input: "https://example.com/video.mp4"
}
{:ok, asset, _} = Mux.Video.Assets.create(client, params);
Check out the Mux Elixir SDK docs for more information.