Modern WebRTC Ice Candidate dump
by jib1
HTML
<div id="div"></div>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
JavaScript
const server = { urls: "stun:stun.l.google.com:19302" };
const pc = new RTCPeerConnection({ iceServers: [server] });
pc.onicecandidate = ({candidate}) => {
log("STRING: "+ candidate.candidate);
log(candidate.foundation);
log(candidate.component);
log(candidate.priority);
log(candidate.ip);
log(candidate.protocol);
log(candidate.port);
log(candidate.type);
log(candidate.tcpType);
log(candidate.relatedAddress);
log(candidate.relatedPort);
log(candidate.usernameFragment);
}
pc.addTransceiver("video");
pc.createOffer()
.then(offer => pc.setLocalDescription(offer))
.catch(e => log(e));
var log = msg => div.innerHTML += msg + "<br>";