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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
|
/**
* jsxc v0.7.0 - 2014-03-07
*
* Copyright (c) 2014 Klaus Herberth <klaus@jsxc.org> <br>
* Released under the MIT license
*
* Please see http://jsxc.org/
*
* @author Klaus Herberth <klaus@jsxc.org>
* @version 0.7.0
*/
/* jsxc, Strophe, SDPUtil, getUserMediaWithConstraints, setupRTC, jQuery */
var RTC = null, RTCPeerconnection = null;
jsxc.gui.template.incomingCall = '<h3>%%Incoming_call%%</h3>\
<p>%%Do_you_want_to_accept_the_call_from%% {{cid_name}}?</p>\
<p class="jsxc_right">\
<a href="#" class="button jsxc_reject">%%Reject%%</a> <a href="#" class="button creation jsxc_accept">%%Accept%%</a>\
</p>';
jsxc.gui.template.allowMediaAccess = '<p>%%Please_allow_access_to_microphone_and_camera%%</p>';
jsxc.gui.template.videoWindow = '<div class="jsxc_webrtc">\
<div class="jsxc_videoContainer">\
<video class="jsxc_localvideo" autoplay></video>\
<video class="jsxc_remotevideo" autoplay></video>\
<div class="jsxc_status"></div>\
</div>\
<div class="jsxc_controlbar">\
<button type="button" class="jsxc_hangUp">%%hang_up%%</button>\
<input type="range" class="jsxc_volume" min="0.0" max="1.0" step="0.05" value="0.5" />\
<div class="jsxc_buttongroup">\
<button type="button" class="jsxc_snapshot">%%snapshot%%</button><button type="button" class="jsxc_snapshots">▼</button>\
</div>\
<!-- <button type="button" class="jsxc_mute_local">%%mute_my_audio%%</button>\
<button type="button" class="jsxc_pause_local">%%pause_my_video%%</button> --> \
<button type="button" class="jsxc_showchat">%%chat%%</button>\
<button type="button" class="jsxc_fullscreen">%%fullscreen%%</button>\
<button type="button" class="jsxc_info">%%Info%%</button>\
</div>\
<div class="jsxc_multi">\
<div class="jsxc_snapshotbar">\
<p>No pictures yet!</p>\
</div>\n\
<div class="jsxc_chatarea">\
<ul></ul>\
</div>\
<div class="jsxc_infobar"></div>\
</div>\
</div>';
(function($) {
"use strict";
/**
* WebRTC namespace for jsxc.
*
* @namespace jsxc.webrtc
*/
jsxc.webrtc = {
/** strophe connection */
conn: null,
/** local video stream */
localStream: null,
/** remote video stream */
remoteStream: null,
/** jid of the last caller */
last_caller: null,
/** should we auto accept incoming calls? */
AUTO_ACCEPT: false,
/** required disco features */
reqVideoFeatures: [ 'urn:xmpp:jingle:apps:rtp:video', 'urn:xmpp:jingle:apps:rtp:audio', 'urn:xmpp:jingle:transports:ice-udp:1' ],
/** bare jid to current jid mapping */
chatJids: {},
/**
* Initialize webrtc plugin.
*
* @private
* @memberOf jsxc.webrtc
*/
init: function() {
var self = jsxc.webrtc;
// shortcut
self.conn = jsxc.xmpp.conn;
if (RTC.browser === 'firefox') {
self.conn.jingle.media_constraints.mandatory.MozDontOfferDataChannel = true;
}
if (!self.conn.jingle) {
jsxc.error('No jingle plugin found!');
return;
}
// jingle configuration
self.conn.jingle.PRANSWER = false;
self.conn.jingle.AUTOACCEPT = false;
self.conn.jingle.ice_config = jsxc.storage.getUserItem('iceConfig');
self.conn.jingle.MULTIPARTY = false;
self.conn.jingle.pc_constraints = RTC.pc_constraints;
$(document).on('message.jsxc', $.proxy(self.onMessage, self));
$(document).on('mediaready.jingle', $.proxy(self.onMediaReady, self));
$(document).on('mediafailure.jingle', $.proxy(self.onMediaFailure, self));
$(document).on('callincoming.jingle', $.proxy(self.onCallIncoming, self));
$(document).on('callterminated.jingle', $.proxy(self.onCallTerminated, self));
$(document).on('ringing.jingle', $.proxy(self.onCallRinging, self));
$(document).on('remotestreamadded.jingle', $.proxy(self.onRemoteStreamAdded, self));
$(document).on('remotestreamremoved.jingle', $.proxy(self.onRemoteStreamRemoved, self));
$(document).on('iceconnectionstatechange.jingle', $.proxy(self.onIceConnectionStateChanged, self));
$(document).on('nostuncandidates.jingle', $.proxy(self.noStunCandidates, self));
$(document).on('error.jingle', function(ev, sid, error) {
jsxc.error('[JINGLE]', error);
});
if (self.conn.caps) {
$(document).on('caps.strophe', $.proxy(self.onCaps, self));
}
self.getTurnCrendentials();
},
/**
* Checks if cached configuration is valid and if necessary update it.
*
* @memberOf jsxc.webrtc
*/
getTurnCrendentials: function() {
if (!jsxc.options.turnCredentialsPath) {
jsxc.debug('No path for TURN credentials defined!');
return;
}
var ttl = (jsxc.storage.getUserItem('iceValidity') || 0) - (new Date()).getTime();
if (ttl > 0) {
// credentials valid
window.setTimeout(jsxc.webrtc.getTurnCrendentials, ttl + 500);
return;
}
$.ajax(jsxc.options.turnCredentialsPath, {
async: true,
success: function(data) {
var iceConfig = {
iceServers: [ {
url: 'turn:' + data.url,
credential: data.credential,
username: data.username
} ]
};
jsxc.webrtc.conn.jingle.ice_config = iceConfig;
jsxc.storage.setUserItem('iceConfig', iceConfig);
jsxc.storage.setUserItem('iceValidity', (new Date()).getTime() + 1000 * data.ttl);
}
});
},
/**
* Add "video" button to window menu.
*
* @private
* @memberOf jsxc.webrtc
* @param event
* @param win jQuery window object
*/
initWindow: function(event, win) {
var self = jsxc.webrtc;
if (!self.conn) {
$(document).one('connectionReady.jsxc', function() {
self.initWindow(null, win);
});
return;
}
var li = $('<li>Video</li>').addClass('jsxc_video');
win.find('.jsxc_settings ul').append(li);
self.updateWindow(win);
},
/**
* Enable or disable "video" button and assign full jid.
*
* @memberOf jsxc.webrtc
* @param win jQuery window object
*/
updateWindow: function(win) {
if (!win || win.length === 0) {
return;
}
var self = jsxc.webrtc;
var jid = win.data('jid');
var li = win.find('.jsxc_video');
// only start video call to a full jid
if (Strophe.getResourceFromJid(jid) === null) {
var cid = jsxc.jidToCid(jid);
var res = jsxc.storage.getUserItem('buddy_' + cid).res;
if (Array.isArray(res) && res.length === 1) {
jid += '/' + res[0];
}
}
li.off('click');
if (self.conn.caps.hasFeatureByJid(jid, self.reqVideoFeatures)) {
li.click(function() {
self.startCall(jid);
});
li.removeClass('jsxc_disabled');
} else {
li.addClass('jsxc_disabled');
}
},
/**
* Check if full jid changed.
*
* @private
* @memberOf jsxc.webrtc
* @param e
* @param from full jid
*/
onMessage: function(e, from) {
var self = jsxc.webrtc;
var bJid = Strophe.getBareJidFromJid(from);
if (self.chatJids[bJid] !== from) {
self.updateWindow(jsxc.gui.getWindow(jsxc.jidToCid(bJid)));
self.chatJids[bJid] = from;
}
},
/**
* Display status message to user.
*
* @memberOf jsxc.webrtc
* @param txt message
* @param d duration in ms
*/
setStatus: function(txt, d) {
var status = $('.jsxc_webrtc .jsxc_status');
var duration = (typeof d === 'undefined' || d === null) ? 4000 : d;
jsxc.debug('[Webrtc]', txt);
if (status.html()) {
// attach old messages
txt = status.html() + '<br />' + txt;
}
status.html(txt);
status.css({
'margin-left': '-' + (status.width() / 2) + 'px',
opacity: 0,
display: 'block'
});
status.stop().animate({
opacity: 1
});
clearTimeout(status.data('timeout'));
if (duration === 0) {
return;
}
var to = setTimeout(function() {
status.stop().animate({
opacity: 0
}, function() {
status.html('');
});
}, duration);
status.data('timeout', to);
},
/**
* Update "video" button if we receive cap information.
*
* @private
* @memberOf jsxc.webrtc
* @param event
* @param jid
*/
onCaps: function(event, jid) {
var self = jsxc.webrtc;
var win = jsxc.gui.getWindow(jsxc.jidToCid(jid));
if (win.length > 0) {
self.updateWindow(win);
}
},
/**
* Called if video/audio is ready. Open window and display some messages.
*
* @private
* @memberOf jsxc.webrtc
* @param event
* @param stream
*/
onMediaReady: function(event, stream) {
jsxc.debug('media ready');
var self = jsxc.webrtc;
self.localStream = stream;
self.conn.jingle.localStream = stream;
jsxc.gui.showVideoWindow(self.last_caller);
var i;
for (i = 0; i < stream.getAudioTracks().length; i++) {
self.setStatus((stream.getAudioTracks().length > 0) ? 'Use local audio device.' : 'No local audio device.');
jsxc.debug('using audio device "' + stream.getAudioTracks()[i].label + '"');
}
for (i = 0; i < stream.getVideoTracks().length; i++) {
self.setStatus((stream.getVideoTracks().length > 0) ? 'Use local video device.' : 'No local video device.');
jsxc.debug('using video device "' + stream.getVideoTracks()[i].label + '"');
}
$(document).one('cleanup.dialog.jsxc', $.proxy(self.hangUp, self));
$(document).trigger('finish.mediaready.jsxc');
},
/**
* Called if media failes.
*
* @private
* @memberOf jsxc.webrtc
*/
onMediaFailure: function() {
this.setStatus('media failure');
},
/**
* Called on incoming call.
*
* @private
* @memberOf jsxc.webrtc
* @param event
* @param sid Session id
*/
onCallIncoming: function(event, sid) {
jsxc.debug('incoming call' + sid);
var self = this;
var sess = this.conn.jingle.sessions[sid];
var jid = jsxc.jidToCid(sess.peerjid);
// display notification
jsxc.notification.notify(jsxc.translate('%%Incoming call%%'), jsxc.translate('%%from%% ' + jid));
// send signal to partner
sess.sendRinging();
jsxc.webrtc.last_caller = sess.peerjid;
jsxc.switchEvents({
'mediaready.jingle': function(event, stream) {
self.setStatus('Accept call');
sess.localStream = stream;
sess.peerconnection.addStream(stream);
sess.sendAnswer();
sess.accept();
},
'mediafailure.jingle': function() {
sess.sendTerminate('decline');
sess.terminate();
}
});
if (jsxc.webrtc.AUTO_ACCEPT) {
self.reqUserMedia();
return;
}
var dialog = jsxc.gui.dialog.open(jsxc.gui.template.get('incomingCall', jsxc.jidToCid(jid)));
dialog.find('.jsxc_accept').click(function() {
$(document).trigger('accept.call.jsxc');
self.reqUserMedia();
});
dialog.find('.jsxc_reject').click(function() {
jsxc.gui.dialog.close();
$(document).trigger('reject.call.jsxc');
sess.sendTerminate('decline');
sess.terminate();
});
},
/**
* Called if call is terminated.
*
* @private
* @memberOf jsxc.webrtc
* @param event
* @param sid Session id
* @param reason Reason for termination
* @param [text] Optional explanation
*/
onCallTerminated: function(event, sid, reason, text) {
this.setStatus('call terminated ' + sid + (reason ? (': ' + reason + ' ' + text) : ''));
if (this.localStream) {
this.localStream.stop();
}
$('.jsxc_remotevideo')[0].src = "";
$('.jsxc_localvideo')[0].src = "";
this.conn.jingle.localStream = null;
this.localStream = null;
this.remoteStream = null;
$('#jsxc_windowList > ul').prepend($('#jsxc_dialog .jsxc_chatarea > ul > li').detach());
$(document).off('cleanup.dialog.jsxc');
$(document).off('error.jingle');
jsxc.gui.dialog.close();
},
/**
* Remote station is ringing.
*
* @private
* @memberOf jsxc.webrtc
*/
onCallRinging: function() {
this.setStatus('ringing...', 0);
},
/**
* Called if we receive a remote stream.
*
* @private
* @memberOf jsxc.webrtc
* @param event
* @param data
* @param sid Session id
*/
onRemoteStreamAdded: function(event, data, sid) {
this.setStatus('Remote stream for session ' + sid + ' added.');
var stream = data.stream;
this.remoteStream = stream;
var sess = this.conn.jingle.sessions[sid];
var isVideoDevice = stream.getVideoTracks().length > 0;
var isAudioDevice = stream.getAudioTracks().length > 0;
sess.remoteDevices = {
video: isVideoDevice,
audio: isAudioDevice
};
this.setStatus(isVideoDevice ? 'Use remote video device.' : 'No remote video device');
this.setStatus(isAudioDevice ? 'Use remote audio device.' : 'No remote audio device');
if ($('.jsxc_remotevideo').length) {
RTC.attachMediaStream($('.jsxc_remotevideo'), stream);
}
},
/**
* Called if the remote stream was removed.
*
* @private
* @meberOf jsxc.webrtc
* @param event
* @param data
* @param sid Session id
*/
onRemoteStreamRemoved: function(event, data, sid) {
this.setStatus('Remote stream for session ' + sid + ' removed.');
},
/**
* Extracts local and remote ip and display it to the user.
*
* @private
* @memberOf jsxc.webrtc
* @param event
* @param sid session id
* @param sess
*/
onIceConnectionStateChanged: function(event, sid, sess) {
var sigState = sess.peerconnection.signalingState;
var iceCon = sess.peerconnection.iceConnectionState;
jsxc.debug('iceGat state for ' + sid, sess.peerconnection.iceGatheringState);
jsxc.debug('iceCon state for ' + sid, iceCon);
jsxc.debug('sig state for ' + sid, sigState);
if (sigState === 'stable' && iceCon === 'connected') {
var localSDP = sess.peerconnection.localDescription.sdp;
var remoteSDP = sess.peerconnection.remoteDescription.sdp;
sess.local_fp = SDPUtil.parse_fingerprint(SDPUtil.find_line(localSDP, 'a=fingerprint:')).fingerprint;
sess.remote_fp = SDPUtil.parse_fingerprint(SDPUtil.find_line(remoteSDP, 'a=fingerprint:')).fingerprint;
var ip_regex = "(\\d{1,3}\\.\\d{1,3}.\\d{1,3}\\.\\d{1,3}) \\d+ typ host";
sess.remote_ip = remoteSDP.match(new RegExp(ip_regex))[1];
sess.local_ip = localSDP.match(new RegExp(ip_regex))[1];
var regex = new RegExp(ip_regex, 'g');
var match;
while ((match = regex.exec(remoteSDP)) !== null) {
if (match[1] !== sess.remote_ip) {
alert('!!! WARNING !!!\n\nPossible Man-in-the-middle attack detected!\n\nYou should close the connection.');
return;
}
}
var text = '<p>';
text += '<b>' + jsxc.translate('%%Local IP%%: ') + '</b>' + sess.local_ip + '<br />';
text += '<b>' + jsxc.translate('%%Remote IP%%: ') + '</b>' + sess.remote_ip + '<br />';
text += '<b>' + jsxc.translate('%%Local Fingerprint%%: ') + '</b>' + sess.local_fp + '<br />';
text += '<b>' + jsxc.translate('%%Remote Fingerprint%%: ') + '</b>' + sess.remote_fp;
text += '</p>';
$('#jsxc_dialog .jsxc_infobar').html(text);
}
},
/**
* No STUN candidates found
*
* @private
* @memberOf jsxc.webrtc
*/
noStunCandidates: function() {
},
/**
* Start a call to the specified jid.
*
* @memberOf jsxc.webrtc
* @param jid full jid
*/
startCall: function(jid) {
var self = this;
if (Strophe.getResourceFromJid(jid) === null) {
jsxc.debug('We need a full jid');
return;
}
self.last_caller = jid;
jsxc.switchEvents({
'finish.mediaready.jsxc': function() {
self.setStatus('Initiate call');
$(document).one('error.jingle', function(e, sid, error) {
if (error.source !== 'offer') {
return;
}
$(document).off('cleanup.dialog.jsxc');
setTimeout(function() {
jsxc.gui.showAlert("Sorry, we couldn't establish a connection. Maybe your buddy is offline.");
}, 500);
});
self.conn.jingle.initiate(jid, self.conn.jid.toLowerCase());
},
'mediafailure.jingle': function() {
jsxc.gui.dialog.close();
}
});
this.reqUserMedia();
},
/**
* Hang up the current call.
*
* @memberOf jsxc.webrtc
*/
hangUp: function() {
$(document).off('cleanup.dialog.jsxc');
jsxc.webrtc.conn.jingle.terminate(null);
$(document).trigger('callterminated.jingle');
},
/**
* Request video and audio from local user.
*
* @memberOf jsxc.webrtc
*/
reqUserMedia: function() {
if (this.localStream) {
$(document).trigger('mediaready.jingle', [ this.localStream ]);
return;
}
jsxc.gui.dialog.open(jsxc.gui.template.get('allowMediaAccess'), {
noClose: true
});
this.setStatus('please allow access to microphone and camera');
getUserMediaWithConstraints([ 'video', 'audio' ]);
},
/**
* Make a snapshot from a video stream and display it.
*
* @memberOf
* @param video Video stream
*/
snapshot: function(video) {
if (!video) {
jsxc.debug('Missing video element');
}
$('.jsxc_snapshotbar p').remove();
var canvas = $('<canvas/>').css('display', 'none').appendTo('body').attr({
width: video.width(),
height: video.height()
}).get(0);
var ctx = canvas.getContext('2d');
ctx.drawImage(video[0], 0, 0);
var img = $('<img/>');
var url = canvas.toDataURL('image/jpeg');
img[0].src = url;
var link = $('<a/>').attr({
target: '_blank',
href: url
});
link.append(img);
$('.jsxc_snapshotbar').append(link);
canvas.remove();
}
};
/**
* Display window for video call.
*
* @memberOf jsxc.gui
*/
jsxc.gui.showVideoWindow = function(jid) {
var self = jsxc.webrtc;
$(document).one('complete.dialog.jsxc', function() {
// mute own video element to avoid echoes
$('#jsxc_dialog .jsxc_localvideo')[0].muted = true;
$('#jsxc_dialog .jsxc_localvideo')[0].volume = 0;
var rv = $('#jsxc_dialog .jsxc_remotevideo');
var lv = $('#jsxc_dialog .jsxc_localvideo');
lv.draggable({
containment: "parent"
});
RTC.attachMediaStream(lv, self.localStream);
var w_dialog = $('#jsxc_dialog').width();
var w_remote = rv.width();
// fit in video
if (w_remote > w_dialog) {
var scale = w_dialog / w_remote;
var new_h = rv.height() * scale;
var new_w = w_dialog;
var vc = $('#jsxc_dialog .jsxc_videoContainer');
rv.height(new_h);
rv.width(new_w);
vc.height(new_h);
vc.width(new_w);
lv.height(lv.height() * scale);
lv.width(lv.width() * scale);
}
if (self.remoteStream) {
RTC.attachMediaStream(rv, self.remoteStream);
}
var toggleMulti = function(elem, open) {
$('#jsxc_dialog .jsxc_multi > div').not(elem).slideUp();
var opt = {
complete: jsxc.gui.dialog.resize
};
if (open) {
elem.slideDown(opt);
} else {
elem.slideToggle(opt);
}
};
var win = jsxc.gui.window.open(jsxc.jidToCid(jid));
$('#jsxc_dialog .jsxc_chatarea ul').append(win.detach());
$('#jsxc_dialog .jsxc_hangUp').click(function() {
jsxc.webrtc.hangUp();
});
$('#jsxc_dialog .jsxc_snapshot').click(function() {
jsxc.webrtc.snapshot(rv);
toggleMulti($('#jsxc_dialog .jsxc_snapshotbar'), true);
});
$('#jsxc_dialog .jsxc_snapshots').click(function() {
toggleMulti($('#jsxc_dialog .jsxc_snapshotbar'));
});
$('#jsxc_dialog .jsxc_showchat').click(function() {
toggleMulti($('#jsxc_dialog .jsxc_chatarea'));
});
$('#jsxc_dialog .jsxc_info').click(function() {
toggleMulti($('#jsxc_dialog .jsxc_infobar'));
});
$('#jsxc_dialog .jsxc_fullscreen').click(function() {
if ($.support.fullscreen) {
// Reset position of localvideo
$(document).one('disabled.fullscreen', function() {
lv.removeAttr('style');
});
$('#jsxc_dialog .jsxc_videoContainer').fullscreen();
}
});
$('#jsxc_dialog .jsxc_volume').change(function() {
rv[0].volume = $(this).val();
});
$('#jsxc_dialog .jsxc_volume').dblclick(function() {
$(this).val(0.5);
});
});
jsxc.gui.dialog.open(jsxc.gui.template.get('videoWindow'), {
noClose: true
});
};
$.extend(jsxc.CONST, {
KEYCODE_ENTER: 13,
KEYCODE_ESC: 27
});
$(document).ready(function() {
RTC = setupRTC();
if (RTC !== null) {
RTCPeerconnection = RTC.peerconnection;
$(document).on('init.window.jsxc', jsxc.webrtc.initWindow);
$(document).on('attached.jsxc', jsxc.webrtc.init);
}
});
$.extend(jsxc.l10n.en, {
Please_allow_access_to_microphone_and_camera: 'Please allow access to microphone and camera.',
Incoming_call: 'Incoming call',
from: 'from',
Do_you_want_to_accept_the_call_from: 'Do you want to accept the call from',
Reject: 'Reject',
Accept: 'Accept',
hang_up: 'hang up',
snapshot: 'snapshot',
mute_my_audio: 'mute my audio',
pause_my_video: 'pause my video',
fullscreen: 'fullscreen',
Info: 'Info',
Local_IP: 'Local IP',
Remote_IP: 'Remote IP',
Local_Fingerprint: 'Local fingerprint',
Remote_Fingerprint: 'Remote fingerprint',
});
$.extend(jsxc.l10n.de, {
Please_allow_access_to_microphone_and_camera: 'Bitte erlaube den Zugriff auf Kamera und Mikrofon.',
Incoming_call: 'Eingehender Anruf',
from: 'von',
Do_you_want_to_accept_the_call_from: 'Möchtest Du den Anruf annehmen von',
Reject: 'Ablehnen',
Accept: 'Annehmen',
hang_up: 'Auflegen',
snapshot: 'Schnappschuss',
mute_my_audio: 'Mein Ton aus',
pause_my_video: 'Mein Video pausieren',
fullscreen: 'Vollbild',
Info: 'Info',
Local_IP: 'Lokale IP',
Remote_IP: 'Remote IP',
Local_Fingerprint: 'Lokaler Fingerprint',
Remote_Fingerprint: 'Remote Fingerprint',
});
}(jQuery));
|