pc.addEventListener("iceconnectionstatechange", (ev) => {
let stateElem = document.querySelector("#call-state");
stateElem.className = `${pc.iceConnectionState}-state`;
});RTCPeerConnection: iceconnectionstatechange event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
pc.oniceconnectionstatechange = (ev) => {
let stateElem = document.querySelector("#call-state");
stateElem.className = `${pc.iceConnectionState}-state`;
};