|
@@ -19,11 +19,11 @@ function init() {
|
19
|
19
|
if (RTC === null) {
|
20
|
20
|
window.location.href = 'webrtcrequired.html';
|
21
|
21
|
return;
|
22
|
|
- } else if (RTC.browser != 'chrome') {
|
|
22
|
+ } else if (RTC.browser !== 'chrome') {
|
23
|
23
|
window.location.href = 'chromeonly.html';
|
24
|
24
|
return;
|
25
|
25
|
}
|
26
|
|
- RTCPeerconnection = TraceablePeerConnection;
|
|
26
|
+ RTCPeerconnection = TraceablePeerConnection;
|
27
|
27
|
|
28
|
28
|
connection = new Strophe.Connection(document.getElementById('boshURL').value || config.bosh || '/http-bind');
|
29
|
29
|
|
|
@@ -44,12 +44,12 @@ function init() {
|
44
|
44
|
var jid = document.getElementById('jid').value || config.hosts.domain || window.location.hostname;
|
45
|
45
|
|
46
|
46
|
connection.connect(jid, document.getElementById('password').value, function (status) {
|
47
|
|
- if (status == Strophe.Status.CONNECTED) {
|
|
47
|
+ if (status === Strophe.Status.CONNECTED) {
|
48
|
48
|
console.log('connected');
|
49
|
49
|
if (config.useStunTurn) {
|
50
|
50
|
connection.jingle.getStunAndTurnCredentials();
|
51
|
51
|
}
|
52
|
|
- if (RTC.browser == 'firefox') {
|
|
52
|
+ if (RTC.browser === 'firefox') {
|
53
|
53
|
getUserMediaWithConstraints(['audio']);
|
54
|
54
|
} else {
|
55
|
55
|
getUserMediaWithConstraints(['audio', 'video'], config.resolution || '360');
|
|
@@ -118,10 +118,10 @@ $(document).bind('mediaready.jingle', function (event, stream) {
|
118
|
118
|
updateLargeVideo($(this).attr('src'), true, 0);
|
119
|
119
|
|
120
|
120
|
$('video').each(function (idx, el) {
|
121
|
|
- if (el.id.indexOf('mixedmslabel') != -1) {
|
|
121
|
+ if (el.id.indexOf('mixedmslabel') !== -1) {
|
122
|
122
|
el.volume = 0;
|
123
|
123
|
el.volume = 1;
|
124
|
|
- }
|
|
124
|
+ }
|
125
|
125
|
});
|
126
|
126
|
});
|
127
|
127
|
|
|
@@ -131,11 +131,11 @@ $(document).bind('mediaready.jingle', function (event, stream) {
|
131
|
131
|
$(document).bind('mediafailure.jingle', function () {
|
132
|
132
|
// FIXME
|
133
|
133
|
});
|
134
|
|
-
|
|
134
|
+
|
135
|
135
|
$(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
136
|
136
|
function waitForRemoteVideo(selector, sid) {
|
137
|
137
|
var sess = connection.jingle.sessions[sid];
|
138
|
|
- if (data.stream.id == 'mixedmslabel') return;
|
|
138
|
+ if (data.stream.id === 'mixedmslabel') return;
|
139
|
139
|
videoTracks = data.stream.getVideoTracks();
|
140
|
140
|
if (videoTracks.length === 0 || selector[0].currentTime > 0) {
|
141
|
141
|
RTC.attachMediaStream(selector, data.stream); // FIXME: why do i have to do this for FF?
|
|
@@ -148,10 +148,10 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
148
|
148
|
var sess = connection.jingle.sessions[sid];
|
149
|
149
|
|
150
|
150
|
// look up an associated JID for a stream id
|
151
|
|
- if (data.stream.id.indexOf('mixedmslabel') == -1) {
|
|
151
|
+ if (data.stream.id.indexOf('mixedmslabel') === -1) {
|
152
|
152
|
var ssrclines = SDPUtil.find_lines(sess.peerconnection.remoteDescription.sdp, 'a=ssrc');
|
153
|
153
|
ssrclines = ssrclines.filter(function (line) {
|
154
|
|
- return line.indexOf('mslabel:' + data.stream.label) != -1;
|
|
154
|
+ return line.indexOf('mslabel:' + data.stream.label) !== -1;
|
155
|
155
|
});
|
156
|
156
|
if (ssrclines.length) {
|
157
|
157
|
thessrc = ssrclines[0].substring(7).split(' ')[0];
|
|
@@ -179,7 +179,7 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
179
|
179
|
//console.log('found container for', data.peerjid);
|
180
|
180
|
}
|
181
|
181
|
} else {
|
182
|
|
- if (data.stream.id != 'mixedmslabel') {
|
|
182
|
+ if (data.stream.id !== 'mixedmslabel') {
|
183
|
183
|
console.warn('can not associate stream', data.stream.id, 'with a participant');
|
184
|
184
|
}
|
185
|
185
|
// FIXME: for the mixed ms we dont need a video -- currently
|
|
@@ -195,7 +195,7 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
195
|
195
|
vid.oncontextmenu = function () { return false; };
|
196
|
196
|
container.appendChild(vid);
|
197
|
197
|
// TODO: make mixedstream display:none via css?
|
198
|
|
- if (id.indexOf('mixedmslabel') != -1) {
|
|
198
|
+ if (id.indexOf('mixedmslabel') !== -1) {
|
199
|
199
|
container.id = 'mixedstream';
|
200
|
200
|
$(container).hide();
|
201
|
201
|
}
|
|
@@ -232,8 +232,8 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
232
|
232
|
}
|
233
|
233
|
);
|
234
|
234
|
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
|
235
|
|
- if (data.peerjid && sess.peerjid == data.peerjid &&
|
236
|
|
- data.stream.getVideoTracks().length == 0 &&
|
|
235
|
+ if (data.peerjid && sess.peerjid === data.peerjid &&
|
|
236
|
+ data.stream.getVideoTracks().length === 0 &&
|
237
|
237
|
connection.jingle.localStream.getVideoTracks().length > 0) {
|
238
|
238
|
window.setTimeout(function() {
|
239
|
239
|
sendKeyframe(sess.peerconnection);
|
|
@@ -244,7 +244,7 @@ $(document).bind('remotestreamadded.jingle', function (event, data, sid) {
|
244
|
244
|
// an attempt to work around https://github.com/jitsi/jitmeet/issues/32
|
245
|
245
|
function sendKeyframe(pc) {
|
246
|
246
|
console.log('sendkeyframe', pc.iceConnectionState);
|
247
|
|
- if (pc.iceConnectionState != 'connected') return; // safe...
|
|
247
|
+ if (pc.iceConnectionState !== 'connected') return; // safe...
|
248
|
248
|
pc.setRemoteDescription(
|
249
|
249
|
pc.remoteDescription,
|
250
|
250
|
function () {
|
|
@@ -350,7 +350,7 @@ $(document).bind('callincoming.jingle', function (event, sid) {
|
350
|
350
|
});
|
351
|
351
|
|
352
|
352
|
$(document).bind('callactive.jingle', function (event, videoelem, sid) {
|
353
|
|
- if (videoelem.attr('id').indexOf('mixedmslabel') == -1) {
|
|
353
|
+ if (videoelem.attr('id').indexOf('mixedmslabel') === -1) {
|
354
|
354
|
// ignore mixedmslabela0 and v0
|
355
|
355
|
videoelem.show();
|
356
|
356
|
resizeThumbnails();
|
|
@@ -464,18 +464,18 @@ $(document).bind('left.muc', function (event, jid) {
|
464
|
464
|
$(container).hide();
|
465
|
465
|
resizeThumbnails();
|
466
|
466
|
}
|
467
|
|
- if (focus === null && connection.emuc.myroomjid == connection.emuc.list_members[0]) {
|
|
467
|
+ if (focus === null && connection.emuc.myroomjid === connection.emuc.list_members[0]) {
|
468
|
468
|
console.log('welcome to our new focus... myself');
|
469
|
469
|
focus = new ColibriFocus(connection, config.hosts.bridge);
|
470
|
470
|
if (Object.keys(connection.emuc.members).length > 0) {
|
471
|
471
|
focus.makeConference(Object.keys(connection.emuc.members));
|
472
|
472
|
}
|
473
|
473
|
$(document).trigger('focusechanged.muc', [focus]);
|
474
|
|
- }
|
|
474
|
+ }
|
475
|
475
|
else if (focus && Object.keys(connection.emuc.members).length === 0) {
|
476
|
476
|
console.log('everyone left');
|
477
|
477
|
if (focus !== null) {
|
478
|
|
- // FIXME: closing the connection is a hack to avoid some
|
|
478
|
+ // FIXME: closing the connection is a hack to avoid some
|
479
|
479
|
// problemswith reinit
|
480
|
480
|
if (focus.peerconnection !== null) {
|
481
|
481
|
focus.peerconnection.close();
|
|
@@ -494,11 +494,11 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
|
494
|
494
|
ssrc2jid[ssrc.getAttribute('ssrc')] = jid;
|
495
|
495
|
|
496
|
496
|
// might need to update the direction if participant just went from sendrecv to recvonly
|
497
|
|
- if (ssrc.getAttribute('type') == 'video') {
|
|
497
|
+ if (ssrc.getAttribute('type') === 'video') {
|
498
|
498
|
var el = $('#participant_' + Strophe.getResourceFromJid(jid) + '>video');
|
499
|
499
|
switch(ssrc.getAttribute('direction')) {
|
500
|
500
|
case 'sendrecv':
|
501
|
|
- el.show();
|
|
501
|
+ el.show();
|
502
|
502
|
break;
|
503
|
503
|
case 'recvonly':
|
504
|
504
|
el.hide();
|
|
@@ -532,7 +532,7 @@ $(document).bind('passwordrequired.muc', function (event, jid) {
|
532
|
532
|
{
|
533
|
533
|
var lockKey = document.getElementById('lockKey');
|
534
|
534
|
|
535
|
|
- if (lockKey.value != null)
|
|
535
|
+ if (lockKey.value !== null)
|
536
|
536
|
{
|
537
|
537
|
setSharedKey(lockKey.value);
|
538
|
538
|
connection.emuc.doJoin(jid, lockKey.value);
|
|
@@ -551,7 +551,7 @@ $(document).bind('presentationremoved.muc', function(event, jid, presUrl) {
|
551
|
551
|
setPresentationVisible(false);
|
552
|
552
|
$('#participant_' + Strophe.getResourceFromJid(jid) + '_' + presId).remove();
|
553
|
553
|
$('#presentation>iframe').remove();
|
554
|
|
- if (preziPlayer != null) {
|
|
554
|
+ if (preziPlayer !== null) {
|
555
|
555
|
preziPlayer.destroy();
|
556
|
556
|
preziPlayer = null;
|
557
|
557
|
}
|
|
@@ -585,8 +585,8 @@ $(document).bind('presentationadded.muc', function (event, jid, presUrl, current
|
585
|
585
|
else {
|
586
|
586
|
var e = event.toElement || event.relatedTarget;
|
587
|
587
|
|
588
|
|
- while(e && e.parentNode && e.parentNode != window) {
|
589
|
|
- if (e.parentNode == this || e == this) {
|
|
588
|
+ while(e && e.parentNode && e.parentNode !== window) {
|
|
589
|
+ if (e.parentNode === this || e === this) {
|
590
|
590
|
return false;
|
591
|
591
|
}
|
592
|
592
|
e = e.parentNode;
|
|
@@ -608,8 +608,8 @@ $(document).bind('presentationadded.muc', function (event, jid, presUrl, current
|
608
|
608
|
|
609
|
609
|
preziPlayer.on(PreziPlayer.EVENT_STATUS, function(event) {
|
610
|
610
|
console.log("prezi status", event.value);
|
611
|
|
- if (event.value == PreziPlayer.STATUS_CONTENT_READY) {
|
612
|
|
- if (jid != connection.emuc.myroomjid)
|
|
611
|
+ if (event.value === PreziPlayer.STATUS_CONTENT_READY) {
|
|
612
|
+ if (jid !== connection.emuc.myroomjid)
|
613
|
613
|
preziPlayer.flyToStep(currentSlide);
|
614
|
614
|
}
|
615
|
615
|
});
|
|
@@ -680,8 +680,8 @@ function setPresentationVisible(visible) {
|
680
|
680
|
}
|
681
|
681
|
}
|
682
|
682
|
|
683
|
|
-var isPresentationVisible = function () {
|
684
|
|
- return ($('#presentation>iframe') != null && $('#presentation>iframe').css('opacity') == 1);
|
|
683
|
+function isPresentationVisible() {
|
|
684
|
+ return ($('#presentation>iframe') !== null && $('#presentation>iframe').css('opacity') == 1);
|
685
|
685
|
}
|
686
|
686
|
|
687
|
687
|
/**
|
|
@@ -692,7 +692,7 @@ function updateLargeVideo(newSrc, localVideo, vol) {
|
692
|
692
|
|
693
|
693
|
setPresentationVisible(false);
|
694
|
694
|
|
695
|
|
- if ($('#largeVideo').attr('src') != newSrc) {
|
|
695
|
+ if ($('#largeVideo').attr('src') !== newSrc) {
|
696
|
696
|
|
697
|
697
|
document.getElementById('largeVideo').volume = vol;
|
698
|
698
|
|
|
@@ -700,10 +700,10 @@ function updateLargeVideo(newSrc, localVideo, vol) {
|
700
|
700
|
$(this).attr('src', newSrc);
|
701
|
701
|
|
702
|
702
|
var videoTransform = document.getElementById('largeVideo').style.webkitTransform;
|
703
|
|
- if (localVideo && videoTransform != 'scaleX(-1)') {
|
|
703
|
+ if (localVideo && videoTransform !== 'scaleX(-1)') {
|
704
|
704
|
document.getElementById('largeVideo').style.webkitTransform = "scaleX(-1)";
|
705
|
705
|
}
|
706
|
|
- else if (!localVideo && videoTransform == 'scaleX(-1)') {
|
|
706
|
+ else if (!localVideo && videoTransform === 'scaleX(-1)') {
|
707
|
707
|
document.getElementById('largeVideo').style.webkitTransform = "none";
|
708
|
708
|
}
|
709
|
709
|
|
|
@@ -880,7 +880,7 @@ function buttonClick(id, classname) {
|
880
|
880
|
*/
|
881
|
881
|
function openLockDialog() {
|
882
|
882
|
// Only the focus is able to set a shared key.
|
883
|
|
- if (focus == null) {
|
|
883
|
+ if (focus === null) {
|
884
|
884
|
if (sharedKey)
|
885
|
885
|
$.prompt("This conversation is currently protected by a shared secret key.",
|
886
|
886
|
{
|
|
@@ -981,7 +981,7 @@ function openSettingsDialog() {
|
981
|
981
|
}
|
982
|
982
|
/*
|
983
|
983
|
var lockKey = document.getElementById('lockKey');
|
984
|
|
-
|
|
984
|
+
|
985
|
985
|
if (lockKey.value)
|
986
|
986
|
{
|
987
|
987
|
setSharedKey(lockKey.value);
|
|
@@ -1013,7 +1013,7 @@ function openPreziDialog() {
|
1013
|
1013
|
}
|
1014
|
1014
|
});
|
1015
|
1015
|
}
|
1016
|
|
- else if (preziPlayer != null) {
|
|
1016
|
+ else if (preziPlayer !== null) {
|
1017
|
1017
|
$.prompt("Another participant is already sharing a Prezi." +
|
1018
|
1018
|
"This conference allows only one Prezi at a time.",
|
1019
|
1019
|
{
|
|
@@ -1044,8 +1044,8 @@ function openPreziDialog() {
|
1044
|
1044
|
var urlValue
|
1045
|
1045
|
= encodeURI(Util.escapeHtml(preziUrl.value));
|
1046
|
1046
|
|
1047
|
|
- if (urlValue.indexOf('http://prezi.com/') != 0
|
1048
|
|
- && urlValue.indexOf('https://prezi.com/') != 0)
|
|
1047
|
+ if (urlValue.indexOf('http://prezi.com/') !== 0
|
|
1048
|
+ && urlValue.indexOf('https://prezi.com/') !== 0)
|
1049
|
1049
|
{
|
1050
|
1050
|
$.prompt.goToState('state1');
|
1051
|
1051
|
return false;
|
|
@@ -1077,7 +1077,7 @@ function openPreziDialog() {
|
1077
|
1077
|
defaultButton: 1,
|
1078
|
1078
|
submit:function(e,v,m,f) {
|
1079
|
1079
|
e.preventDefault();
|
1080
|
|
- if(v==0)
|
|
1080
|
+ if (v === 0)
|
1081
|
1081
|
$.prompt.close();
|
1082
|
1082
|
else
|
1083
|
1083
|
$.prompt.goToState('state0');
|
|
@@ -1127,7 +1127,7 @@ function updateLockButton() {
|
1127
|
1127
|
*/
|
1128
|
1128
|
function showToolbar() {
|
1129
|
1129
|
$('#toolbar').css({visibility:"visible"});
|
1130
|
|
- if (focus != null)
|
|
1130
|
+ if (focus !== null)
|
1131
|
1131
|
{
|
1132
|
1132
|
// TODO: Enable settings functionality. Need to uncomment the settings button in index.html.
|
1133
|
1133
|
// $('#settingsButton').css({visibility:"visible"});
|
|
@@ -1145,7 +1145,7 @@ function updateRoomUrl(newRoomUrl) {
|
1145
|
1145
|
* Warning to the user that the conference window is about to be closed.
|
1146
|
1146
|
*/
|
1147
|
1147
|
function closePageWarning() {
|
1148
|
|
- if (focus != null)
|
|
1148
|
+ if (focus !== null)
|
1149
|
1149
|
return "You are the owner of this conference call and you are about to end it.";
|
1150
|
1150
|
else
|
1151
|
1151
|
return "You are about to leave this conversation.";
|
|
@@ -1157,10 +1157,10 @@ function closePageWarning() {
|
1157
|
1157
|
* from the connection.jingle.sessions.
|
1158
|
1158
|
*/
|
1159
|
1159
|
function showFocusIndicator() {
|
1160
|
|
- if (focus != null) {
|
|
1160
|
+ if (focus !== null) {
|
1161
|
1161
|
var indicatorSpan = $('#localVideoContainer .focusindicator');
|
1162
|
1162
|
|
1163
|
|
- if (indicatorSpan.children().length == 0)
|
|
1163
|
+ if (indicatorSpan.children().length === 0)
|
1164
|
1164
|
{
|
1165
|
1165
|
createFocusIndicatorElement(indicatorSpan[0]);
|
1166
|
1166
|
}
|
|
@@ -1172,11 +1172,11 @@ function showFocusIndicator() {
|
1172
|
1172
|
var focusContainer = document.getElementById(focusId);
|
1173
|
1173
|
var indicatorSpan = $('#' + focusId + ' .focusindicator');
|
1174
|
1174
|
|
1175
|
|
- if (!indicatorSpan || indicatorSpan.length == 0) {
|
|
1175
|
+ if (!indicatorSpan || indicatorSpan.length === 0) {
|
1176
|
1176
|
indicatorSpan = document.createElement('span');
|
1177
|
1177
|
indicatorSpan.className = 'focusindicator';
|
1178
|
1178
|
focusContainer.appendChild(indicatorSpan);
|
1179
|
|
-
|
|
1179
|
+
|
1180
|
1180
|
createFocusIndicatorElement(indicatorSpan);
|
1181
|
1181
|
}
|
1182
|
1182
|
}
|
|
@@ -1197,12 +1197,12 @@ function addRemoteVideoContainer(id) {
|
1197
|
1197
|
function createFocusIndicatorElement(parentElement) {
|
1198
|
1198
|
var focusIndicator = document.createElement('i');
|
1199
|
1199
|
focusIndicator.className = 'fa fa-star';
|
1200
|
|
- focusIndicator.title = "The owner of this conference"
|
|
1200
|
+ focusIndicator.title = "The owner of this conference";
|
1201
|
1201
|
parentElement.appendChild(focusIndicator);
|
1202
|
1202
|
}
|
1203
|
1203
|
|
1204
|
1204
|
/**
|
1205
|
|
- * Toggles the application in and out of full screen mode
|
|
1205
|
+ * Toggles the application in and out of full screen mode
|
1206
|
1206
|
* (a.k.a. presentation mode in Chrome).
|
1207
|
1207
|
*/
|
1208
|
1208
|
function toggleFullScreen() {
|
|
@@ -1214,7 +1214,7 @@ function toggleFullScreen() {
|
1214
|
1214
|
if (fsElement.mozRequestFullScreen) {
|
1215
|
1215
|
|
1216
|
1216
|
fsElement.mozRequestFullScreen();
|
1217
|
|
- }
|
|
1217
|
+ }
|
1218
|
1218
|
else {
|
1219
|
1219
|
fsElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
1220
|
1220
|
}
|
|
@@ -1243,8 +1243,8 @@ function showDisplayName(videoSpanId, displayName) {
|
1243
|
1243
|
if (nameSpan.length > 0) {
|
1244
|
1244
|
var nameSpanElement = nameSpan.get(0);
|
1245
|
1245
|
|
1246
|
|
- if (nameSpanElement.id == 'localDisplayName'
|
1247
|
|
- && $('#localDisplayName').html() != escDisplayName)
|
|
1246
|
+ if (nameSpanElement.id === 'localDisplayName'
|
|
1247
|
+ && $('#localDisplayName').html() !== escDisplayName)
|
1248
|
1248
|
$('#localDisplayName').html(escDisplayName);
|
1249
|
1249
|
else
|
1250
|
1250
|
$('#' + videoSpanId + '_name').html(escDisplayName);
|
|
@@ -1252,7 +1252,7 @@ function showDisplayName(videoSpanId, displayName) {
|
1252
|
1252
|
else {
|
1253
|
1253
|
var editButton = null;
|
1254
|
1254
|
|
1255
|
|
- if (videoSpanId == 'localVideoContainer') {
|
|
1255
|
+ if (videoSpanId === 'localVideoContainer') {
|
1256
|
1256
|
editButton = createEditDisplayNameButton();
|
1257
|
1257
|
}
|
1258
|
1258
|
if (escDisplayName.length) {
|
|
@@ -1289,7 +1289,7 @@ function showDisplayName(videoSpanId, displayName) {
|
1289
|
1289
|
$('#editDisplayName').select();
|
1290
|
1290
|
|
1291
|
1291
|
var inputDisplayNameHandler = function(name) {
|
1292
|
|
- if (nickname != name) {
|
|
1292
|
+ if (nickname !== name) {
|
1293
|
1293
|
nickname = Util.escapeHtml(name);
|
1294
|
1294
|
window.localStorage.displayname = nickname;
|
1295
|
1295
|
connection.emuc.addDisplayNameToPresence(nickname);
|
|
@@ -1310,7 +1310,7 @@ function showDisplayName(videoSpanId, displayName) {
|
1310
|
1310
|
});
|
1311
|
1311
|
|
1312
|
1312
|
$('#editDisplayName').on('keydown', function (e) {
|
1313
|
|
- if (e.keyCode == 13) {
|
|
1313
|
+ if (e.keyCode === 13) {
|
1314
|
1314
|
e.preventDefault();
|
1315
|
1315
|
inputDisplayNameHandler(this.value);
|
1316
|
1316
|
}
|