I am trying to get the membrane_hackney_plugin to send files to a CDN. Trying to get it to work with one file and then set it up for HLS if all goes well. I'm getting an error whenever I run it.
The Code:
defmodule Membrane.Demo.SimplePipeline do
use Membrane.Pipeline
alias Membrane.{File, Hackney}
@impl true
def handle_init(_context, _) do
structure = [
child(:source, %Membrane.File.Source{location: "./sample.mp3"})
|> child(:sink, %Membrane.Hackney.Sink{method: :put, location: build_uri("my-bucket", "sample.mp3"), headers: [access_key(),
{"content-type", "audio/flac"}]}),
]
{[spec: {structure, []}, playback: :playing], %{}}
end
@impl true
def handle_notification(%Hackney.Sink.Response{} = response, from, _ctx, state) do
IO.inspect({from, response})
{[], state}
end
def handle_notification(_notification, _from, _ctx, state) do
{[], state}
end
defp access_key do
{"AccessKey", "foo-bar"}
end
defp build_uri(bucket, name) do
"https://storage.bunnycdn.com/ny.storage.bunnycdn.com/#{bucket}/" <>
URI.encode_query(upload_type: "media", name: name)
end
end
and the error
** (MatchError) no match of right hand side value: {:error, :req_not_found}
(membrane_hackney_plugin 0.9.0) lib/membrane_hackney/sink.ex:93: Membrane.Hackney.Sink.handle_end_of_stream/3
(membrane_core 0.11.3) lib/membrane/core/callback_handler.ex:138: Membrane.Core.CallbackHandler.exec_callback/4
(membrane_core 0.11.3) lib/membrane/core/callback_handler.ex:62: Membrane.Core.CallbackHandler.exec_and_handle_callback/5
(membrane_core 0.11.3) lib/membrane/core/element/event_controller.ex:79:
...