{"id":18000145,"url":"https://github.com/muxinc/mux-elixir","last_synced_at":"2025-10-11T03:40:40.319Z","repository":{"id":32116650,"uuid":"130398474","full_name":"muxinc/mux-elixir","owner":"muxinc","description":"Official Mux API wrapper for Elixir projects, supporting both Mux Data and Mux Video.","archived":false,"fork":false,"pushed_at":"2024-07-02T22:57:41.000Z","size":212,"stargazers_count":81,"open_issues_count":5,"forks_count":13,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-09-07T16:51:32.665Z","etag":null,"topics":["elixir","mux","video","video-analytics","video-processing","video-streaming"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/mux","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muxinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-20T18:16:30.000Z","updated_at":"2025-09-04T22:42:36.000Z","dependencies_parsed_at":"2024-06-21T14:18:35.931Z","dependency_job_id":"076b3d80-61e1-441a-ba01-0d745ae5284b","html_url":"https://github.com/muxinc/mux-elixir","commit_stats":{"total_commits":71,"total_committers":20,"mean_commits":3.55,"dds":0.8309859154929577,"last_synced_commit":"3a60631477146ba29596219084b11256ce69b412"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/muxinc/mux-elixir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muxinc%2Fmux-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muxinc%2Fmux-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muxinc%2Fmux-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muxinc%2Fmux-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muxinc","download_url":"https://codeload.github.com/muxinc/mux-elixir/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muxinc%2Fmux-elixir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006111,"owners_count":26084027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","mux","video","video-analytics","video-processing","video-streaming"],"created_at":"2024-10-29T23:09:51.903Z","updated_at":"2025-10-11T03:40:40.288Z","avatar_url":"https://github.com/muxinc.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Mux Elixir Banner](github-elixir-sdk.png)\n\n# Mux Elixir\n\n![test workflow status](https://github.com/muxinc/mux-elixir/actions/workflows/ci.yml/badge.svg)\n\n\u003c!-- MDOC !--\u003e\n\nOfficial Mux API wrapper for Elixir projects, supporting both Mux Data and Mux Video.\n\n[Mux Video](https://mux.com/video) is an API-first platform, powered by data and designed by video experts to make beautiful video possible for every development team.\n\n[Mux Data](https://mux.com/data) is a platform for monitoring your video streaming performance with just a few lines of code. Get in-depth quality of service analytics on web, mobile, and OTT devices.\n\nNot familiar with Mux? Check out https://mux.com/ for more information.\n\n## Installation\n\nAdd `mux` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:mux, \"~\u003e 3.2.2\"}\n  ]\nend\n```\n\n## Quickstart\n\nWe'll put our access token in our application configuration.\n\n```elixir\n# config/dev.exs\nconfig :mux,\n  access_token_id: \"abcd1234\",\n  access_token_secret: \"efghijkl\"\n```\n\nThen use this config to initialize a new client in your application.\n\n```elixir\nclient = Mux.client()\n```\n\nYou can also pass the access token ID and secret directly to `client/2` function if you'd prefer:\n\n```elixir\nclient = Mux.client(\"access_token_id\", \"access_token_secret\")\n```\n\nNow we can use the client to do anything your heart desires (to do with the Mux API). From here we can\ncreate new videos, manage playback IDs, etc.\n\n```elixir\n{:ok, asset, raw_env} = Mux.Video.Assets.create(client, %{input: \"https://example.com/video.mp4\"});\n```\n\nEvery successful response will come back with a 3 item tuple starting with `:ok`. The second item\nis whatever's in the `data` key, which will typically be the the item you were interacting with. In\nthe example above, it's a single `asset`. The third item is the raw [Tesla](https://github.com/teamon/tesla)\nEnv, which is basically the raw response object. This can be useful if you want to get to metadata we\ninclude, such as the timeframe used or the total row count returned, or if you just want to get to\nheaders such as the request ID for support reasons.\n\n## Usage in Phoenix\n\nCreating a new client before making a request is simple, but you may not want to do it every\nsingle time you need to use a function in a controller. We suggest using `action/2` to initialize\nthe client and pass that to each of the controller functions.\n\n```elixir\ndef action(conn, _) do\n  mux_client = Mux.client() # or Mux.client(\"access_token_id\", \"access_token_secret\")\n  args = [conn, conn.params, mux_client]\n  apply(__MODULE__, action_name(conn), args)\nend\n\ndef create(conn, params, mux_client) do\n  # ...\n  {:ok, asset, _} = mux_client |\u003e Mux.Video.Assets.create(%{input: \"http://example.com/input.mp4\"})\n  # ...\nend\n```\n\n#### Verifying Webhook Signatures in Phoenix\n\nNote that when calling `Mux.Webhooks.verify_header/3` in Phoenix you will need to pass in the raw request\nbody, not the parsed JSON. Phoenix has a nice solution for doing this [example](https://github.com/phoenixframework/phoenix/issues/459#issuecomment-440820663).\n\nRead more about verifying webhook signatures in [our guide](https://docs.mux.com/docs/webhook-security)\n\n```elixir\ndefmodule MyAppWeb.BodyReader do\n  def read_body(conn, opts) do\n    {:ok, body, conn} = Plug.Conn.read_body(conn, opts)\n    conn = update_in(conn.assigns[:raw_body], \u0026[body | \u00261 || []])\n    {:ok, body, conn}\n  end\nend\n\n# endpoint.ex\nplug Plug.Parsers,\n  parsers: [:urlencoded, :multipart, :json],\n  pass: [\"*/*\"],\n  body_reader: {MyAppWeb.BodyReader, :read_body, []},\n  json_decoder: Phoenix.json_library()\n\n# controller\nsignature_header = List.first(get_req_header(conn, \"mux-signature\"))\nraw_body = List.first(conn.assigns.raw_body)\nMux.Webhooks.verify_header(raw_body, signature_header, secret)\n```\n\nYou will most likely have to store the raw body before it gets parsed and then extract it later and\npass it into `Mux.Webhooks.verify_header/3`\n\n\u003c!-- MDOC !--\u003e\n\n---\n\n## Publishing new versions\n\n1. Update version in mix.exs\n1. Update version in README\n1. Commit and open a PR\n1. After code is merged, tag master ex: `git tag v1.7.0` and `git push --tags`\n1. run `mix hex.publish`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuxinc%2Fmux-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuxinc%2Fmux-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuxinc%2Fmux-elixir/lists"}