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
PD🧩 Plasmo Developers
Created by Villain In Glasses on 5/23/2024 in #🔰newbie
npm run dev gives: SyntaxError: missing ) after argument list
Here is my package.json
{
"name": "meets-helper",
"displayName": "Meets helper",
"version": "0.0.1",
"description": "A Google Meets translator",
"author": "[email protected]",
"scripts": {
"dev": "plasmo dev",
"build": "plasmo build",
"package": "plasmo package"
},
"dependencies": {
"@ricky0123/vad-react": "0.0.23",
"plasmo": "0.86.3",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "4.1.1",
"@types/chrome": "0.0.258",
"@types/node": "20.11.5",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"prettier": "3.2.4",
"typescript": "5.3.3"
},
"manifest": {
"host_permissions": [
"https://*/*"
]
}
}
{
"name": "meets-helper",
"displayName": "Meets helper",
"version": "0.0.1",
"description": "A Google Meets translator",
"author": "[email protected]",
"scripts": {
"dev": "plasmo dev",
"build": "plasmo build",
"package": "plasmo package"
},
"dependencies": {
"@ricky0123/vad-react": "0.0.23",
"plasmo": "0.86.3",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "4.1.1",
"@types/chrome": "0.0.258",
"@types/node": "20.11.5",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"prettier": "3.2.4",
"typescript": "5.3.3"
},
"manifest": {
"host_permissions": [
"https://*/*"
]
}
}
I've attached the error stack as well. Please help
2 replies