This commit is contained in:
parent
8a22a15f86
commit
41dfe61afd
@ -65,12 +65,23 @@ dataChannel.onclose = () => {
|
||||
console.log("📴 Client: Data channel closed");
|
||||
};
|
||||
|
||||
const restartIce = (pc, ws) => {
|
||||
setInterval(async () => {
|
||||
const offer = await pc.createOffer({ iceRestart: true });
|
||||
await pc.setLocalDescription(offer);
|
||||
ws.send(JSON.stringify({ type: 'offer', data: offer }));
|
||||
}, 50000)
|
||||
}
|
||||
|
||||
ws0.onopen = async () => {
|
||||
pc0.addTransceiver('video', { direction: 'recvonly' });
|
||||
pc0.addTransceiver('audio', { direction: 'recvonly' })
|
||||
const offer = await pc0.createOffer();
|
||||
await pc0.setLocalDescription(offer);
|
||||
ws0.send(JSON.stringify({ type: 'offer', data: offer }));
|
||||
if (isSecure) {
|
||||
restartIce(pc0,ws0);
|
||||
}
|
||||
}
|
||||
|
||||
ws0.onmessage = async (message) => {
|
||||
|
Loading…
Reference in New Issue
Block a user