4.8.3 RTCPeerConnectionIceErrorEvent接口

RTCPeerConnectionicecandidateerror 事件使用 RTCPeerConnectionIceErrorEvent 接口。

  1. [Constructor(DOMString type, RTCPeerConnectionIceErrorEventInit eventInitDict),
  2. Exposed=Window]
  3. interface RTCPeerConnectionIceErrorEvent : Event {
  4. readonly attribute DOMString hostCandidate;
  5. readonly attribute DOMString url;
  6. readonly attribute unsigned short errorCode;
  7. readonly attribute USVString errorText;
  8. };
构造函数

RTCPeerConnectionIceErrorEvent

属性

hostCandidate的类型为DOMString, 只读项:

hostCandidate属性是用于与STUN或TURN服务器通信的本地IP地址和端口。

在多宿主系统上,可以使用多个接口来联系服务器,该属性允许应用程序确定故障发生在哪一个上。

如果出于隐私原因禁止使用多个接口,则此属性将根据需要设置为0.0.0.0:0或[::]:0。

url的类型为DOMString, 只读项:

url属性是 STUN 或 TURN URL ,用于标识发生故障的STUN或TURN服务器。

errorCode的类型为unsigned short,只读项:

errorCode属性是 STUN 或 TURN 服务器 [STUN-PARAMETERS] 返回的数字 STUN 错误代码。

如果没有主机候选者可以到达服务器,则 errorCode 将被设置为超出 STUN 错误代码范围的值701。在“收集”的RTCIceGatheringState中,每个服务器 URL 仅触发一次此错误。

errorText的类型为USVString, 只读项:

errorText属性是 STUN 或 TURN 服务器 [STUN-PARAMETERS] 返回的 STUN 原因文本。

如果无法访问服务器,则errorText将设置为特定于实现的值,提供有关错误的详细信息。

  1. dictionary RTCPeerConnectionIceErrorEventInit : EventInit {
  2. DOMString hostCandidate;
  3. DOMString url;
  4. required unsigned short errorCode;
  5. USVString statusText;
  6. };
字典RTCPeerConnectionIceErrorEventInit的成员

hostCandidate的类型为DOMString

用于与 STUN 或 TURN 服务器通信的本地地址和端口。

url的类型为DOMString:

STUN 或 TURN URL ,用于标识发生故障的STUN或TURN服务器。

errorCode的类型为unsigned short,必需项:

STUN 或 TURN 服务器返回的数字 STUN 错误代码。

statusText的类型为USVString:

STUN 或 TURN 服务器返回的 STUN 原因文本。