-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublic.confkuui.js
41 lines (35 loc) · 1.17 KB
/
public.confkuui.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var confkuUI = {};
confkuUI.addVideo = function (stream, peerId) {
var vidElem = this.cloneVideo('localVideo', 'video' + peerId);
var vidDivElem = this.newVideoDiv(peerId);
vidDivElem.appendChild(vidElem);
document.getElementById('row_videos').appendChild(vidDivElem);
return vidElem;
};
confkuUI.removeVideo = function (peerId) {
var vidDivId = 'div' + peerId;
var vidDiv = document.getElementById(vidDivId);
vidDiv.parentNode.removeChild(vidDiv);
};
confkuUI.cloneVideo = function (sourceId, destId) {
var source = document.getElementById(sourceId);
var dest = source.cloneNode(false);
dest.id = destId;
dest.removeAttribute('muted');
dest.autoplay = true;
return dest;
};
confkuUI.newVideoDiv = function (peerId) {
var elem = document.createElement('div');
elem.setAttribute('class', "col-md-3");
elem.id = 'div'+peerId;
return elem;
};
confku.ee.on('peer_join_room', function (data) {
var msg = "[[" + Date().toString() + "]] '" + data.name + "' entered this room\n";
$('#chat_ta_id').append(msg);
});
confku.ee.on('peer_leave_room', function (data) {
var msg = "[[" + Date().toString() + "]] '" + data.name + "' leave this room\n";
$('#chat_ta_id').append(msg);
});