TsgcWSPServer_WebRTC › 属性 › WebRTC
信令配置:推送给加入对端的 STUN/TURN ICE 服务器 URI 列表,以及已关闭会话的挂断策略。
property WebRTC: TsgcWSWebRTC_Options read FWebRTC write SetWebRTC;
IceServers 为空,CloseSessionOnHangup = True
两个信令级选项的容器。IceServers 是 JSON 条目的 TStringList(例如 {"urls":"stun:stun.l.google.com:19302"} 或带凭据的 turn: 条目);当客户端连接时,服务器推送携带该列表的 sgc@iceservers 帧,以便浏览器直接将其传递给 RTCPeerConnection。CloseSessionOnHangup 决定当对等方发送 {"type":"bye"} 时的处理方式:为 True 时频道将被拆除,所有订阅者被移除;为 False 时服务器将帧重写为 {"type":"remote-close"},仅递减订阅者计数,以便剩余对等方可以重新协商。
WebRTCSrv.WebRTC.IceServers.Add('{"urls":"stun:stun.l.google.com:19302"}');
WebRTCSrv.WebRTC.IceServers.Add(
'{"urls":"turn:turn.example.com:3478",' +
'"username":"alice","credential":"s3cret"}');
WebRTCSrv.WebRTC.CloseSessionOnHangup := True;