MuxWrapper.Assets (Mux Wrapper v0.1.3) View Source

Provides a wrapper of assets to manipulate Mux API

Link to this section Summary

Functions

Provide create asset to Mux, suggest read Mux doc first

Provide delete asset from Mux, suggest read Mux doc first

Provide get asset from Mux, suggest read Mux doc first

Provide get asset info from Mux, suggest read Mux doc first

Provide list assets from Mux, suggest read Mux doc first

Provide mp4 support(added) to Mux, suggest read Mux doc first

Provide mp4 not support(removed video) to Mux, suggest read Mux doc first

Provide a high qulity link to download from Mux, suggest read Mux doc first

Link to this section Functions

Link to this function

create_asset(client, params)

View Source

Specs

create_asset(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  Enum.t()
) :: tuple()

Provide create asset to Mux, suggest read Mux doc first

Parameters

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.create_asset(client, %{input: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"})
{:ok, 
  %MuxWrapper.EmbeddedSchema.Asset{
    created_at: ~N[2021-03-19 13:13:26],
    id: "gbxJ8PYkJg9TOPhP0100gYIlZKqgCai4mBnummQu8YKUI",
    master_access: "none",
    mp4_support: "none",
    playback_ids: [],
    status: "preparing"
  }
}
Link to this function

delete_asset(client, asset_id)

View Source

Specs

delete_asset(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  String.t()
) :: tuple()

Provide delete asset from Mux, suggest read Mux doc first

Parameters

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.delete_asset(client, "asset_id_very_long")
{:ok}
Link to this function

get_asset(client, asset_id)

View Source

Specs

get_asset(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  String.t()
) :: tuple()

Provide get asset from Mux, suggest read Mux doc first

Parameters

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.get_asset(client, "asset_id_very_long")
{:ok, 
  %MuxWrapper.EmbeddedSchema.Asset{
    aspect_ratio: nil,
    created_at: ~N[2021-03-19 14:09:04],
    duration: nil,
    id: "Aq02lD2TppLOibpXfrf5iHkwhTSuL666mYu02rfq7tHiA",
    master_access: "none",
    max_stored_frame_rate: nil,
    max_stored_resolution: nil,
    mp4_support: "none",
    playback_ids: [],
    status: "ready",
    test: nil,
    tracks: [
      %MuxWrapper.EmbeddedSchema.Track{
        duration: 60.095011,
        id: "01I6Bo00WSBCcLhEM01FYV01NeBhcs00w7SdZytiddeYdP01E",
        max_channel_layout: "stereo",
        max_channels: 2,
        max_frame_rate: nil,
        max_height: nil,
        max_width: nil,
        type: "audio"
      },
      %MuxWrapper.EmbeddedSchema.Track{
        duration: 60.095,
        id: "9BnaSlTgXT01nzpPnevBzuFP8i64bcoBUcnz3pdSMG44",
        max_channel_layout: nil,
        max_channels: nil,
        max_frame_rate: 23.962,
        max_height: 360,
        max_width: 640,
        type: "video"
      }
    ]
  }
}
Link to this function

get_asset_input_info(client, asset_id)

View Source

Specs

get_asset_input_info(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  String.t()
) :: tuple()

Provide get asset info from Mux, suggest read Mux doc first

Parameters

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.get_asset_input_info(client, "doS01p7VusXkwqfhe18LDttqIXV4xqXvd53K8ORee501k")
{:ok,
  [
      %MuxWrapper.EmbeddedSchema.AssetInfo{
        file: %MuxWrapper.EmbeddedSchema.File{
          container_format: "mov,mp4,m4a,3gp,3g2,mj2",
          tracks: [
            %MuxWrapper.EmbeddedSchema.Track{
              channels: 2,
              duration: 60.095011,
              encoding: "aac",
              frame_rate: nil,
              height: nil,
              id: nil,
              max_channel_layout: nil,
              max_channels: nil,
              max_frame_rate: nil,
              max_height: nil,
              max_width: nil,
              sample_rate: 22050,
              type: "audio",
              width: nil
            },
            %MuxWrapper.EmbeddedSchema.Track{
              channels: nil,
              duration: 60.095,
              encoding: "h264",
              frame_rate: 23.962,
              height: 360,
              id: nil,
              max_channel_layout: nil,
              max_channels: nil,
              max_frame_rate: nil,
              max_height: nil,
              max_width: nil,
              sample_rate: nil,
              type: "video",
              width: 640
            }
          ]
        },
        settings: %MuxWrapper.EmbeddedSchema.Settings{
          overlay_settings: nil,
          url: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
        }
      },
      %MuxWrapper.EmbeddedSchema.AssetInfo{
        file: %MuxWrapper.EmbeddedSchema.File{
          container_format: "png",
          tracks: [
            %MuxWrapper.EmbeddedSchema.Track{
              channels: nil,
              duration: nil,
              encoding: "png",
              frame_rate: nil,
              height: 346,
              id: nil,
              max_channel_layout: nil,
              max_channels: nil,
              max_frame_rate: nil,
              max_height: nil,
              max_width: nil,
              sample_rate: nil,
              type: "image",
              width: 642
            }
          ]
        },
        settings: %MuxWrapper.EmbeddedSchema.Settings{
          overlay_settings: %MuxWrapper.EmbeddedSchema.OverlaySettings{
            horizontal_align: "center",
            opacity: "100.000000%",
            vertical_align: "bottom",
            vertical_margin: "100px",
            width: "640px"
          },
          url: "https://storage.googleapis.com/muxdemofiles/mux-test-video-watermark.png"
        }
      }
  ]
}
Link to this function

list_assets(client, opt \\ %{})

View Source

Specs

list_assets(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  Enum.t()
) :: tuple()

Provide list assets from Mux, suggest read Mux doc first

Parameters

  • client - provid by MuxWrapper.client/0
  • opt: pagnation query params, can pass a Map like this %{limit: 10, page: 3}. If don't pass, the default value from Mux is limit: 25 and page: 1

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.list_assets(client, %{limit: 1, page: 1})
{:ok,
  [
    %MuxWrapper.EmbeddedSchema.Asset{
      aspect_ratio: "16:9",
      created_at: ~N[2021-03-19 14:37:50],
      duration: 10,
      id: "doS01p7VusXkwqfhe18LDttqIXV4xqXvd53K8ORee501k",
      master_access: "none",
      max_stored_frame_rate: 23.962,
      max_stored_resolution: "SD",
      mp4_support: "none",
      playback_ids: [],
      status: "ready",
      test: true,
      tracks: [
        %MuxWrapper.EmbeddedSchema.Track{
          channels: nil,
          duration: 60.095011,
          encoding: nil,
          frame_rate: nil,
          height: nil,
          id: "J00OusXFvcz9UJo93Vd5bFs1EsXX9cd1HqLs6lPWrRSA",
          max_channel_layout: "stereo",
          max_channels: 2,
          max_frame_rate: nil,
          max_height: nil,
          max_width: nil,
          sample_rate: nil,
          type: "audio",
          width: nil
        },
        %MuxWrapper.EmbeddedSchema.Track{
          channels: nil,
          duration: 60.095,
          encoding: nil,
          frame_rate: nil,
          height: nil,
          id: "2xI4b59vNk02DZ01EmtGk2bOYSb1vY4lmtmb6luBW500Tw",
          max_channel_layout: nil,
          max_channels: nil,
          max_frame_rate: 23.962,
          max_height: 360,
          max_width: 640,
          sample_rate: nil,
          type: "video",
          width: nil
        }
      ]
    }
  ]  
}
Link to this function

set_mp4_support(client, asset_id)

View Source

Specs

set_mp4_support(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  String.t()
) :: tuple()

Provide mp4 support(added) to Mux, suggest read Mux doc first

Parameters

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.set_mp4_support(client, "doS01p7VusXkwqfhe18LDttqIXV4xqXvd53K8ORee501k")
{:ok,
  %MuxWrapper.EmbeddedSchema.Asset{
    aspect_ratio: "16:9",
    created_at: ~N[2021-03-19 14:37:50],
    duration: 10,
    id: "doS01p7VusXkwqfhe18LDttqIXV4xqXvd53K8ORee501k",
    master_access: "temporary",
    max_stored_frame_rate: 23.962,
    max_stored_resolution: "SD",
    mp4_support: "standard",
    playback_ids: [],
    status: "ready",
    test: true,
    tracks: [
      %MuxWrapper.EmbeddedSchema.Track{
        channels: nil,
        duration: 60.095011,
        encoding: nil,
        frame_rate: nil,
        height: nil,
        id: "J00OusXFvcz9UJo93Vd5bFs1EsXX9cd1HqLs6lPWrRSA",
        max_channel_layout: "stereo",
        max_channels: 2,
        max_frame_rate: nil,
        max_height: nil,
        max_width: nil,
        sample_rate: nil,
        type: "audio",
        width: nil
      },
      %MuxWrapper.EmbeddedSchema.Track{
        channels: nil,
        duration: 60.095,
        encoding: nil,
        frame_rate: nil,
        height: nil,
        id: "2xI4b59vNk02DZ01EmtGk2bOYSb1vY4lmtmb6luBW500Tw",
        max_channel_layout: nil,
        max_channels: nil,
        max_frame_rate: 23.962,
        max_height: 360,
        max_width: 640,
        sample_rate: nil,
        type: "video",
        width: nil
      }
    ]
  } 
}
Link to this function

set_mp4_unsupport(client, asset_id)

View Source

Specs

set_mp4_unsupport(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  String.t()
) :: tuple()

Provide mp4 not support(removed video) to Mux, suggest read Mux doc first

Parameters

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.set_mp4_unsupport(client, "doS01p7VusXkwqfhe18LDttqIXV4xqXvd53K8ORee501k")
{:ok,
  %MuxWrapper.EmbeddedSchema.Asset{
    aspect_ratio: "16:9",
    created_at: ~N[2021-03-19 14:37:50],
    duration: 10,
    id: "doS01p7VusXkwqfhe18LDttqIXV4xqXvd53K8ORee501k",
    master_access: "temporary",
    max_stored_frame_rate: 23.962,
    max_stored_resolution: "SD",
    mp4_support: "none",
    playback_ids: [],
    status: "ready",
    test: true,
    tracks: [
      %MuxWrapper.EmbeddedSchema.Track{
        channels: nil,
        duration: 60.095011,
        encoding: nil,
        frame_rate: nil,
        height: nil,
        id: "J00OusXFvcz9UJo93Vd5bFs1EsXX9cd1HqLs6lPWrRSA",
        max_channel_layout: "stereo",
        max_channels: 2,
        max_frame_rate: nil,
        max_height: nil,
        max_width: nil,
        sample_rate: nil,
        type: "audio",
        width: nil
      },
      %MuxWrapper.EmbeddedSchema.Track{
        channels: nil,
        duration: 60.095,
        encoding: nil,
        frame_rate: nil,
        height: nil,
        id: "2xI4b59vNk02DZ01EmtGk2bOYSb1vY4lmtmb6luBW500Tw",
        max_channel_layout: nil,
        max_channels: nil,
        max_frame_rate: 23.962,
        max_height: 360,
        max_width: 640,
        sample_rate: nil,
        type: "video",
        width: nil
      }
    ]
  } 
}
Link to this function

update_master_access(client, asset_id)

View Source

Specs

update_master_access(
  %Tesla.Client{adapter: term(), fun: term(), post: term(), pre: term()},
  String.t()
) :: tuple()

Provide a high qulity link to download from Mux, suggest read Mux doc first

Parameters

Examples

iex> client = MuxWrapper.client()
%Tesla.Client{
  adapter: nil,
  fun: nil,
  post: [],
  pre: [
    {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
    {Tesla.Middleware.BasicAuth, :call,
     [
       %{
         password: "your_password",
         username: "your_username"
       }
     ]}
  ]
}

iex> MuxWrapper.Assets.update_master_access(client, "CO2pRYhPHeLzmv5MnmuRLmUSEYy4TvHj6gKcoU2kM7A")
{:ok,
  %MuxWrapper.EmbeddedSchema.Asset{
    aspect_ratio: "16:9",
    created_at: ~N[2021-03-20 12:43:16],
    duration: 10,
    id: "CO2pRYhPHeLzmv5MnmuRLmUSEYy4TvHj6gKcoU2kM7A",
    master_access: "temporary",
    max_stored_frame_rate: 23.962,
    max_stored_resolution: "SD",
    mp4_support: "none",
    playback_ids: [],
    status: "ready",
    test: true,
    tracks: [
      %MuxWrapper.EmbeddedSchema.Track{
        channels: nil,
        duration: 60.095011,
        encoding: nil,
        frame_rate: nil,
        height: nil,
        id: "kRW00Gn2NfljlA5KBPo01gTf7mijCWvVN801Nh02NTRbTZY",
        max_channel_layout: "stereo",
        max_channels: 2,
        max_frame_rate: nil,
        max_height: nil,
        max_width: nil,
        sample_rate: nil,
        type: "audio",
        width: nil
      },
      %MuxWrapper.EmbeddedSchema.Track{
        channels: nil,
        duration: 60.095,
        encoding: nil,
        frame_rate: nil,
        height: nil,
        id: "Wo6cajmOIRCygGv85fTTVXX29GYSlhUyQVUJA4h41mU",
        max_channel_layout: nil,
        max_channels: nil,
        max_frame_rate: 23.962,
        max_height: 360,
        max_width: 640,
        sample_rate: nil,
        type: "video",
        width: nil
      }
    ]
  }
}