|
@@ -4,8 +4,7 @@
|
|
|
<title>Example webrtc.io</title>
|
|
|
<link type="text/css" href="/style.css" rel="stylesheet"></link>
|
|
|
|
|
|
- <script src="/socket.io/socket.io.js"></script>
|
|
|
- <script src="/webrtc.io/webrtc.io.js"></script>
|
|
|
+ <script src="/webrtc.io.js"></script>
|
|
|
</head>
|
|
|
<body onload="init()">
|
|
|
<div id="videos">
|
|
@@ -56,7 +55,6 @@
|
|
|
var perColumn = Math.ceil(videos.length / perRow);
|
|
|
var width = Math.floor((window.innerWidth) / perRow);
|
|
|
var height = Math.floor((window.innerHeight - 190) / perColumn);
|
|
|
- console.log(width, height);
|
|
|
video.width = width;
|
|
|
video.height = height;
|
|
|
video.style.position = "absolute";
|
|
@@ -80,23 +78,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function initChat() {
|
|
|
-
|
|
|
- var input = document.getElementById("chatinput");
|
|
|
- input.addEventListener('keydown', function(event) {
|
|
|
- var key = event.which || event.keyCode;
|
|
|
- if (key === 13) {
|
|
|
- rtc._socket.emit('chat msg', input.value);
|
|
|
- addToChat(input.value);
|
|
|
- input.value = "";
|
|
|
- }
|
|
|
- }, false);
|
|
|
- rtc._socket.on('receive chat msg', function(data) {
|
|
|
- console.log(data.color);
|
|
|
- addToChat(data.msg, data.color.toString(16));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
function addToChat(msg, color) {
|
|
|
var messages = document.getElementById('messages');
|
|
|
msg = sanitize(msg);
|
|
@@ -162,7 +143,7 @@
|
|
|
//rtc.connect("http://multiwebrtc.nodejitsu.com/", room);
|
|
|
|
|
|
//When using localhost
|
|
|
- rtc.connect("http://localhost:8000/", room);
|
|
|
+ rtc.connect("ws://localhost:8001/", room);
|
|
|
|
|
|
rtc.on('add remote stream', function(stream, socketId) {
|
|
|
console.log("ADDING REMOTE STREAM...");
|
|
@@ -175,7 +156,6 @@
|
|
|
console.log('remove ' + data);
|
|
|
removeVideo(data);
|
|
|
});
|
|
|
- initChat();
|
|
|
initFullScreen();
|
|
|
initNewRoom();
|
|
|
}
|