Skip to content

Commit 217519f

Browse files
authored
Fix ICECandidate types (#174)
1 parent f13a6b4 commit 217519f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/ex_webrtc/ice_candidate.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ defmodule ExWebRTC.ICECandidate do
55

66
@type t() :: %__MODULE__{
77
candidate: binary(),
8-
sdp_mid: non_neg_integer() | nil,
8+
sdp_mid: binary() | nil,
99
sdp_m_line_index: non_neg_integer() | nil,
1010
username_fragment: binary() | nil
1111
}
1212

1313
defstruct [:candidate, :username_fragment, :sdp_mid, :sdp_m_line_index]
1414

15-
@spec to_json(t()) :: %{String.t() => String.t()}
15+
@spec to_json(t()) :: %{String.t() => String.t() | non_neg_integer() | nil}
1616
def to_json(%__MODULE__{} = c) do
1717
%{
1818
"candidate" => c.candidate,
@@ -22,7 +22,7 @@ defmodule ExWebRTC.ICECandidate do
2222
}
2323
end
2424

25-
@spec from_json(%{String.t() => String.t()}) :: t()
25+
@spec from_json(%{String.t() => String.t() | non_neg_integer() | nil}) :: t()
2626
def from_json(%{
2727
"candidate" => c,
2828
"sdpMid" => mid,

lib/ex_webrtc/peer_connection.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ defmodule ExWebRTC.PeerConnection do
11931193
def handle_info({:ex_ice, _from, {:new_candidate, candidate}}, state) do
11941194
candidate = %ICECandidate{
11951195
candidate: "candidate:" <> candidate,
1196-
sdp_mid: 0,
1196+
sdp_mid: "0",
11971197
sdp_m_line_index: 0
11981198
# username_fragment: "vx/1"
11991199
}

0 commit comments

Comments
 (0)