mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2024-11-14 14:19:20 +08:00
refresh only chat.js on disconnect
This commit is contained in:
parent
73edc600f2
commit
4106d01037
@ -123,6 +123,6 @@
|
|||||||
<script src="/socket.io/socket.io.js"></script>
|
<script src="/socket.io/socket.io.js"></script>
|
||||||
<script src="../js/snackbar.js"></script>
|
<script src="../js/snackbar.js"></script>
|
||||||
<script src="../js/autolink.js"></script>
|
<script src="../js/autolink.js"></script>
|
||||||
<script src="../js/chat.js"></script>
|
<script id="chatJS" src="../js/chat.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -137,33 +137,30 @@ var VideoChat = {
|
|||||||
switch (VideoChat.peerConnection.connectionState) {
|
switch (VideoChat.peerConnection.connectionState) {
|
||||||
case "connected":
|
case "connected":
|
||||||
logIt("connected");
|
logIt("connected");
|
||||||
// alert("connected");
|
VideoChat.socket.disconnect();
|
||||||
function onConnect() {
|
|
||||||
VideoChat.socket.disconnect();
|
|
||||||
// VideoChat.peerConnection = null;
|
|
||||||
}
|
|
||||||
setTimeout(onConnect, 100);
|
|
||||||
break;
|
break;
|
||||||
case "disconnected":
|
case "disconnected":
|
||||||
case "failed":
|
case "failed":
|
||||||
logIt("failed/disconnected");
|
logIt("failed/disconnected");
|
||||||
logIt(VideoChat);
|
logIt("Refreshing page...");
|
||||||
// VideoChat.socket = io();
|
function reloadScript(id) {
|
||||||
// VideoChat.socket.on("candidate", VideoChat.onCandidate);
|
var $el = $("#" + id);
|
||||||
// VideoChat.socket.on("answer", VideoChat.onAnswer);
|
$("#" + id).replaceWith(
|
||||||
|
'<script id="' +
|
||||||
location.reload();
|
id +
|
||||||
|
'" src="' +
|
||||||
// startUp();
|
$el.prop("src") +
|
||||||
// alert("failed/disconnected");
|
'"></script>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
reloadScript("chatJS");
|
||||||
|
// location.reload();
|
||||||
break;
|
break;
|
||||||
case "closed":
|
case "closed":
|
||||||
logIt("closed");
|
logIt("closed");
|
||||||
// alert("closed");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user