muxinc / mux-elixir

Official Mux API wrapper for Elixir projects, supporting both Mux Data and Mux Video.
https://hexdocs.pm/mux
MIT License
78 stars 12 forks source link

Mux.Video.LiveStreams#create/3 seems to drop the passthrough key in new_asset_settings option #7

Closed peck closed 4 years ago

peck commented 5 years ago
iex(68)> ret = Mux.Video.LiveStreams.create(client, %{playback_policy: "public", new_asset_settings: %{playback_policy: "public", passthrough: "blarg", mp4_support: "standard"}})
{:ok,
 %{
   "created_at" => "1561078028",
   "id" => "vdWDpFfYJcSbfg3IynYT0002W4ekDfTbSe",
   "new_asset_settings" => %{
     "mp4_support" => "standard",
     "playback_policies" => ["public"]
   },
   "playback_ids" => [
     %{"id" => "8gkpQVBM89WqPchPiYyOycVcjTJThnSt", "policy" => "public"}
   ],
   "reconnect_window" => 60,
   "status" => "idle",
   "stream_key" => <snipped>
 },
 %Tesla.Env{
   __client__: %Tesla.Client{
     fun: nil,
     post: [],
     pre: [
       {Tesla.Middleware.BaseUrl, :call, ["https://api.mux.com"]},
       {Tesla.Middleware.BasicAuth, :call,
        [
          %{
            password: <snipped>,
            username: <snipped>
          }
        ]}
     ]
   },
   __module__: Mux.Base,
   body: %{
     "data" => %{
       "created_at" => "1561078028",
       "id" => "vdWDpFfYJcSbfg3IynYT0002W4ekDfTbSe",
       "new_asset_settings" => %{
         "mp4_support" => "standard",
         "playback_policies" => ["public"]
       },
       "playback_ids" => [
         %{"id" => "8gkpQVBM89WqPchPiYyOycVcjTJThnSt", "policy" => "public"}
       ],
       "reconnect_window" => 60,
       "status" => "idle",
       "stream_key" => <snipped>
     }
   },
   headers: [
     {"cache-control", "max-age=0, private, must-revalidate"},
     {"date", "Fri, 21 Jun 2019 00:47:07 GMT"},
     {"server", "Mux API Server v1.68.2"},
     {"content-length", "324"},
     {"content-type", "application/json; charset=utf-8"},
     {"x-request-id", "2ml10cgdvm1upkt3hg02phe1"}
   ],
   method: :post,
   opts: [],
   query: [],
   status: 201,
   url: "https://api.mux.com/video/v1/live-streams"
 }}

passthrough is missing in the "new_asset_settings" returned.

JacquiManzi commented 5 years ago

Thanks for catching that @peck !

Our api docs are misleading, passthrough should be set on the livestream and not within new_asset_settings. Assets that are created from a livestream will inherit the given passthrough.

Mux.Video.LiveStreams.create(client, %{playback_policy: "public", passthrough: "blarg", new_asset_settings: %{playback_policy: "public", mp4_support: "standard"}})

We're going to update our docs soon and are working on returning an appropriate error message if passthrough is set within the new_asset_settings option.

dylanjha commented 4 years ago

@peck closing this because I believe we updated the docs for creating a live stream. Please re-open if you are having issues with this library. Thanks for bringing it up