diff --git a/src/static/js/video.ts b/src/static/js/video.ts index 371b49c..c6fc4ba 100644 --- a/src/static/js/video.ts +++ b/src/static/js/video.ts @@ -4,20 +4,17 @@ const ws0builder = isSecure ? `wss://${host}/ws0` : `ws://${host}:3001`; const ws1builder = isSecure ? `wss://${host}/ws1` : `ws://${host}:3002`; const ws0 = new WebSocket(ws0builder); const ws1 = new WebSocket(ws1builder); -const pc0 = new RTCPeerConnection({ iceServers: [ - { - urls: 'turn:dwestgate.us:3478?transport=udp', - username: 'webrtcuser', - credential: 'webrtccred' - } -] }); -const pc1 = new RTCPeerConnection({ iceServers: [ - { - urls: 'turn:dwestgate.us:3478?transport=udp', - username: 'webrtcuser', - credential: 'webrtccred' - } -] }); +const config = { + iceServers: [ + { + urls: ['stun:dwestgate.us:3478','turn:dwestgate.us:3478?transport=udp'], + username: 'webrtcuser', + credential: 'webrtccred' + } + ] +}; +const pc0 = new RTCPeerConnection(config); +const pc1 = new RTCPeerConnection(config); const video0 = document.getElementById('video0') as HTMLVideoElement; const video1 = document.getElementById('video1') as HTMLVideoElement; @@ -80,3 +77,20 @@ ws1.onmessage = async (message) => { await pc1.addIceCandidate(msg.data); } }; + +// TODO: Not yet working +// const dc0 = pc0.createDataChannel("keepalive"); +// dc0.onopen = () =>{ +// console.log("Data channel 0 open"); +// setInterval(()=>{ +// dc0.send("ping"); +// },10000) +// } + +// const dc1 = pc1.createDataChannel("keepalive"); +// dc1.onopen = () =>{ +// console.log("Data channel 1 open"); +// setInterval(()=>{ +// dc1.send("ping"); +// },10000) +// }