OctopusRage

OctopusRage

How to use Membrane webrtc for audio only?

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?

Most Liked

varsill

varsill

Membrane Core Team

I see, so as I mentioned before - each of the Membrane.WebRTC.Source and Membrane.WebRTC.Sink elements 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_webrtc that 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

OctopusRage

thx for the insight @varsill , ill take a look

Where Next?

Popular in Discussions Top

Other popular topics Top

josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39247 209
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35953 110
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I'm a nov...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement