For an WebRTC application, I want to signal, that there are no more remote candidates while using Trickle ICE. The W3C WebRTC spec says:
This method can also be used to indicate the end of remote candidates when called with an empty string for the candidate member
and
This can be indicated by calling addIceCandidate with a candidate value whose candidate property is set to an empty string
and
If candidate.candidate is an empty string, process candidate as an end-of-candidates indication
and
If this RTCIceCandidate represents an end-of-candidates indication, candidate is an empty string.
Thus, I tried different methods in Chrome 67, but non of them works:
pc.addIceCandidate('');
TypeError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The provided value is not of type '(RTCIceCandidateInit or RTCIceCandidate)'
pc.addIceCandidate({candidate:''});
TypeError: Candidate missing values for both sdpMid and sdpMLineIndex
pc.addIceCandidate(new IceCandidate());
Failed to construct 'RTCIceCandidate': 1 argument required, but only 0 present.
pc.addIceCandidate(new IceCandidate(''));
Failed to construct 'RTCIceCandidate': parameter 1 ('candidateInitDict') is not an object.
pc.addIceCandidate(new IceCandidate({}));
DOMException: Failed to construct 'RTCIceCandidate': The 'candidate' property is not a string, or is empty.
pc.addIceCandidate(new IceCandidate({candidate:''}));
DOMException: Failed to construct 'RTCIceCandidate': The 'candidate' property is not a string, or is empty.
Question: How do I indicate the end of remote candidates?
[EDIT]:
In 2016/2017, it was just null
:
- https://github.com/w3c/webrtc-pc/pull/527/
- https://webrtcstandards.info/webrtc-trickle-ice/
- http://lists.w3.org/Archives/Public/public-webrtc/2017Mar/0054.html
- https://github.com/w3c/webrtc-pc/issues/1077
The working group decided to keep this special "all gathering is done" null candidate for backwards compatibility"
It seems, that it does not work anymore:
pc.addIceCandidate(null);
TypeError: Candidate missing values for both sdpMid and sdpMLineIndex
pc.addIceCandidate({candidate: null});
TypeError: Candidate missing values for both sdpMid and sdpMLineIndex