Villain In Glasses
Villain In Glasses
Explore posts from servers
SMSoftware Mansion
Created by Villain In Glasses on 7/3/2024 in #membrane-help
How do I invoke Pipeline.handle_info from a Phoenix.WebChannel?
I'm trying to pass audio from a Phoenix Web Channel to a Pipeline. Also, are there any notify_child usage examples? I don't understand how to use Membrane.Pipeline.notify_child. Do I need to define it first? If so, what should the definition look like? Update: I was able to pass a message to the pipeline by making the following changes to my Channel handle_inlike so:
def handle_in("new_audio", %{"data" => audio_data}, socket) do
IO.inspect("pipelines: ")
# IO.inspect(Membrane.Pipeline.list_pipelines())
[head | _] = Membrane.Pipeline.list_pipelines()
# IO.inspect(head)
send(head, audio_data)
{:noreply, socket}
end
def handle_in("new_audio", %{"data" => audio_data}, socket) do
IO.inspect("pipelines: ")
# IO.inspect(Membrane.Pipeline.list_pipelines())
[head | _] = Membrane.Pipeline.list_pipelines()
# IO.inspect(head)
send(head, audio_data)
{:noreply, socket}
end
But I got the error:
[error] <0.768.0>/ Error occured in Membrane Pipeline:
%Membrane.CallbackError{
message: "Invalid value returned from AudioTranscription.StreamToFile.:handle_info:
[error] <0.768.0>/ Error occured in Membrane Pipeline:
%Membrane.CallbackError{
message: "Invalid value returned from AudioTranscription.StreamToFile.:handle_info:
This is what my Membrane.Pipeline.handle_info looks like
@impl true
def handle_info(audio_data, ctx, _state) do
# Process the audio data
IO.inspect("ctx")
IO.inspect(ctx)
IO.inspect("audio_data")
IO.inspect(audio_data)
# ctx.notify_child(AudioTranscription.Source, audio_data)
# AudioTranscription.AudioSource.receive_audio_data(audio_data)
end
@impl true
def handle_info(audio_data, ctx, _state) do
# Process the audio data
IO.inspect("ctx")
IO.inspect(ctx)
IO.inspect("audio_data")
IO.inspect(audio_data)
# ctx.notify_child(AudioTranscription.Source, audio_data)
# AudioTranscription.AudioSource.receive_audio_data(audio_data)
end
9 replies