diff --git a/lib/ex_webrtc/ice_candidate.ex b/lib/ex_webrtc/ice_candidate.ex index 068ba11..59a77ee 100644 --- a/lib/ex_webrtc/ice_candidate.ex +++ b/lib/ex_webrtc/ice_candidate.ex @@ -5,14 +5,14 @@ defmodule ExWebRTC.ICECandidate do @type t() :: %__MODULE__{ candidate: binary(), - sdp_mid: non_neg_integer() | nil, + sdp_mid: binary() | nil, sdp_m_line_index: non_neg_integer() | nil, username_fragment: binary() | nil } defstruct [:candidate, :username_fragment, :sdp_mid, :sdp_m_line_index] - @spec to_json(t()) :: %{String.t() => String.t()} + @spec to_json(t()) :: %{String.t() => String.t() | non_neg_integer() | nil} def to_json(%__MODULE__{} = c) do %{ "candidate" => c.candidate, @@ -22,7 +22,7 @@ defmodule ExWebRTC.ICECandidate do } end - @spec from_json(%{String.t() => String.t()}) :: t() + @spec from_json(%{String.t() => String.t() | non_neg_integer() | nil}) :: t() def from_json(%{ "candidate" => c, "sdpMid" => mid, diff --git a/lib/ex_webrtc/peer_connection.ex b/lib/ex_webrtc/peer_connection.ex index 1178aaf..0c12b4d 100644 --- a/lib/ex_webrtc/peer_connection.ex +++ b/lib/ex_webrtc/peer_connection.ex @@ -1193,7 +1193,7 @@ defmodule ExWebRTC.PeerConnection do def handle_info({:ex_ice, _from, {:new_candidate, candidate}}, state) do candidate = %ICECandidate{ candidate: "candidate:" <> candidate, - sdp_mid: 0, + sdp_mid: "0", sdp_m_line_index: 0 # username_fragment: "vx/1" }