Skip to content

Commit 7b96028

Browse files
authored
Handle ICE candidates with missing usernameFragment (#181)
1 parent 2ef1582 commit 7b96028

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/ex_webrtc/ice_candidate.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ defmodule ExWebRTC.ICECandidate do
2323
end
2424

2525
@spec from_json(%{String.t() => String.t() | non_neg_integer() | nil}) :: t()
26+
def from_json(
27+
%{
28+
"candidate" => c,
29+
"sdpMid" => mid,
30+
"sdpMLineIndex" => mline_idx
31+
} = json
32+
) do
33+
from_json(Map.put(json, "usernameFragment", nil))
34+
end
35+
2636
def from_json(%{
2737
"candidate" => c,
2838
"sdpMid" => mid,

0 commit comments

Comments
 (0)