OctopusRage
hey guys im quite new using membrane, i want to use membrane webrtc to utilize my webrtc call (audio only)
here’s my pipeline
@impl true
def handle_init(_ctx, opts) do
spec =
child(:webrtc_source, %Membrane.WebRTC.Source{
signaling: opts[:ingress_signaling]
})
|> via_out(:output, options: [kind: :audio])
|> child(%Membrane.Transcoder{output_stream_format: Membrane.Opus})
|> child(:audio_realtimer, Membrane.Realtimer)
|> via_in(:input, options: [kind: :audio])
|> child(:webrtc_sink, %Membrane.WebRTC.Sink{
signaling: opts[:egress_signaling]
})
{[spec: spec], %{}}
end
and here’s my channels code
@impl true
def join("call:" <> signaling_id, %{"call_id" => call_id, "role" => role} = payload, socket) when role in ["ingress", "egress"] do
PhoenixSignaling.register_channel(signaling_id)
signaling = PhoenixSignaling.Registry.get(signaling_id)
c_pid = CallHandler.new(call_id)
if role == "egress" do
CallHandler.add_egress(c_pid, signaling_id, signaling)
else
CallHandler.add_ingress(c_pid, signaling_id, signaling)
end
socket = assign(socket, :signaling_id, signaling_id)
{:ok, socket}
end
@impl true
def handle_in(signaling_id, msg, socket) do
IO.inspect({:receive_frombrows, signaling_id, msg})
# msg = Jason.decode!(msg)
PhoenixSignaling.signal(signaling_id, msg)
{:noreply, socket}
end
@impl true
def handle_info({:membrane_webrtc_signaling, _pid, msg, _metadata}, socket) do
IO.inspect({:receive_signal, socket.assigns.signaling_id, msg})
push(socket, socket.assigns.signaling_id, msg)
{:noreply, socket}
end
all my peers successfully doing handshake but media wont flow into my peers
no errors in my code either, did i make some mistake on my pipeline?
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
I’m posting this in response to Jose’s recent tweet (Cr. link) :
People are sleeping on Elixir for a coding harness:
Hot-code swappi...
New
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes.
We’re a small ...
New
I’ve just put together a small POC exploring PDF inspection from Elixir/Phoenix:
The idea is pretty simple: drag & drop a PDF in a...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
varsill
Hello @OctopusRage !
Could you tell where and how do you spawn your pipeline (i.e. what function do you use to spawn your pipeline) and how does the
CallHandler.add_ingress/CallHandler.add_egressfunctions look like?I also assume that the browser is sending only audio, isn’t it?
One tiny thing I see is that a more suggested approach would be to create a signalling with given id with
PhoenixSignaling.new/1in the place where you spawn your pipeline instead of fetching it with privatePhoenixSignaling.Registry.get/1function but I don’t think that the root of the problem.Best wishes!
OctopusRage
hey @varsill
yes browser only send audio
this is callhandler.ex looks like:
current state how i tested it is i open 2 different tabs: 1 tab with ingress peer and other tab is egress peer
OctopusRage
hi @varsill
i finally success implementing my code! thx for the insight
the problem lies on my js code.. so my mistake is assuming that ingress peer can do both record and play
and egress peer can also do both
so my other question is, is it possible to send back audio stream to ingress peer? or i have to do it hacky way?
varsill
Hi once again!
Great to hear that you managed to make it work!
Though the browser supports using a single PeerConnction to handle both egress and ingress tracks, the Membrane Elements (
Membrane.WebRTC.SourceandMembrane.WebRTC.Sink) allow for data transfer only in one direction. So to transfer audio back to the browser that generated it you need to create a new signalling and use it withMembrane.WebRTC.Sinkjust as you would do to transfer data to any other peer.A side question - are you sure you really need to send audio to the server and then send it the back to the browser? Couldn’t it be handled internally in the browser?
OctopusRage
yes im sure i’ll need it, because i would like to replace the ingress peer with communication to the others server peer instead of browser and it requires media to flow without opening new peer connection
varsill
I see, so as I mentioned before - each of the
Membrane.WebRTC.SourceandMembrane.WebRTC.Sinkelements supports only either inbound our outbound traffic for a single PeerConnection, but not both at the time.However it’s possible to write a Membrane component based on
ex_webrtcthat would handle both inbound and outbound tracks with a single PeerConnection - you can take a look at how they did it here: membrane_rtc_engine/ex_webrtc/lib/ex_webrtc_endpoint.ex at master · fishjam-cloud/membrane_rtc_engine · GitHub .Unfortunately it’s more complicated than handling just a single type of tracks.
OctopusRage
thx for the insight @varsill , ill take a look