Skip to content

Manually completing ICE gathering #80

Closed Answered by clone1018
clone1018 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the info! Since the candidates are not in the default answer, that makes total sense. For anyone else following along, this is the code I ended up with to gather the candidates and inject them into the SDP answer:

  defp gather_candidates(candidates) do
    receive do
      {:ex_webrtc, _from, {:ice_candidate, candidate}} ->
        gather_candidates([candidate | candidates])
    after
      400 -> candidates
    end
  end

  defp append_candidates(sdp, candidates) do
    sdp_candidates =
      Enum.map(candidates, fn %ExWebRTC.ICECandidate{candidate: x} -> "a=#{x}" end) ++
        ["a=end-of-candidates"]

    lines = String.split(sdp, "\r\n")

    recv_index = Enum.find_index(l…

Replies: 3 comments 11 replies

Comment options

You must be logged in to vote
2 replies
@clone1018
Comment options

@clone1018
Comment options

Comment options

You must be logged in to vote
4 replies
@clone1018
Comment options

@LVala
Comment options

@clone1018
Comment options

Answer selected by LVala
@LVala
Comment options

Comment options

You must be logged in to vote
5 replies
@clone1018
Comment options

@mickel8
Comment options

@clone1018
Comment options

@Sean-Der
Comment options

@mickel8
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants