Quellcode durchsuchen

Removes some dependancies from functions in app.js.

master
hristoterezov vor 10 Jahren
Ursprung
Commit
27502d3fa8

+ 3
- 58
app.js Datei anzeigen

@@ -44,18 +44,6 @@ var flipXLocalVideo = true;
44 44
 var isFullScreen = false;
45 45
 var currentVideoWidth = null;
46 46
 var currentVideoHeight = null;
47
-/**
48
- * Method used to calculate large video size.
49
- * @type {function ()}
50
- */
51
-var getVideoSize;
52
-/**
53
- * Method used to get large video position.
54
- * @type {function ()}
55
- */
56
-var getVideoPosition;
57
-
58
-/* window.onbeforeunload = closePageWarning; */
59 47
 
60 48
 var sessionTerminated = false;
61 49
 
@@ -624,10 +612,6 @@ function isVideoSrcDesktop(jid) {
624 612
     return isDesktop;
625 613
 }
626 614
 
627
-function getConferenceHandler() {
628
-    return activecall;
629
-}
630
-
631 615
 /**
632 616
  * Mutes/unmutes the local video.
633 617
  *
@@ -639,7 +623,7 @@ function getConferenceHandler() {
639 623
  */
640 624
 function setVideoMute(mute, options) {
641 625
     if (connection && connection.jingle.localVideo) {
642
-        var session = getConferenceHandler();
626
+        var session = activecall;
643 627
 
644 628
         if (session) {
645 629
             session.setVideoMute(
@@ -677,7 +661,7 @@ function toggleVideo() {
677 661
     buttonClick("#video", "icon-camera icon-camera-disabled");
678 662
 
679 663
     if (connection && connection.jingle.localVideo) {
680
-        var session = getConferenceHandler();
664
+        var session = activecall;
681 665
 
682 666
         if (session) {
683 667
             setVideoMute(!session.isVideoMute());
@@ -793,7 +777,7 @@ $(window).bind('beforeunload', function () {
793 777
 
794 778
 function disposeConference(onUnload) {
795 779
     UI.onDisposeConference(onUnload);
796
-    var handler = getConferenceHandler();
780
+    var handler = activecall;
797 781
     if (handler && handler.peerconnection) {
798 782
         // FIXME: probably removing streams is not required and close() should
799 783
         // be enough
@@ -809,45 +793,6 @@ function disposeConference(onUnload) {
809 793
     activecall = null;
810 794
 }
811 795
 
812
-function dump(elem, filename) {
813
-    elem = elem.parentNode;
814
-    elem.download = filename || 'meetlog.json';
815
-    elem.href = 'data:application/json;charset=utf-8,\n';
816
-    var data = populateData();
817
-    elem.href += encodeURIComponent(JSON.stringify(data, null, '  '));
818
-    return false;
819
-}
820
-
821
-
822
-/**
823
- * Populates the log data
824
- */
825
-function populateData() {
826
-    var data = {};
827
-    if (connection.jingle) {
828
-        Object.keys(connection.jingle.sessions).forEach(function (sid) {
829
-            var session = connection.jingle.sessions[sid];
830
-            if (session.peerconnection && session.peerconnection.updateLog) {
831
-                // FIXME: should probably be a .dump call
832
-                data["jingle_" + session.sid] = {
833
-                    updateLog: session.peerconnection.updateLog,
834
-                    stats: session.peerconnection.stats,
835
-                    url: window.location.href
836
-                };
837
-            }
838
-        });
839
-    }
840
-    var metadata = {};
841
-    metadata.time = new Date();
842
-    metadata.url = window.location.href;
843
-    metadata.ua = navigator.userAgent;
844
-    if (connection.logger) {
845
-        metadata.xmpp = connection.logger.log;
846
-    }
847
-    data.metadata = metadata;
848
-    return data;
849
-}
850
-
851 796
 /**
852 797
  * Changes the style class of the element given by id.
853 798
  */

+ 2
- 3
desktopsharing.js Datei anzeigen

@@ -260,10 +260,9 @@ function newStreamCreated(stream) {
260 260
 
261 261
     UI.changeLocalVideo(stream, !isUsingScreenStream);
262 262
 
263
-    var conferenceHandler = getConferenceHandler();
264
-    if (conferenceHandler) {
263
+    if (activecall) {
265 264
         // FIXME: will block switchInProgress on true value in case of exception
266
-        conferenceHandler.switchStreams(stream, oldStream, streamSwitchDone);
265
+        activecall.switchStreams(stream, oldStream, streamSwitchDone);
267 266
     } else {
268 267
         // We are done immediately
269 268
         console.error("No conference handler");

+ 19
- 0
libs/strophe/strophe.jingle.js Datei anzeigen

@@ -321,5 +321,24 @@ Strophe.addConnectionPlugin('jingle', {
321 321
             }
322 322
         );
323 323
         // implement push?
324
+    },
325
+
326
+    /**
327
+     * Populates the log data
328
+     */
329
+    populateData: function () {
330
+        var data = {};
331
+        Object.keys(this.sessions).forEach(function (sid) {
332
+            var session = this.sessions[sid];
333
+            if (session.peerconnection && session.peerconnection.updateLog) {
334
+                // FIXME: should probably be a .dump call
335
+                data["jingle_" + session.sid] = {
336
+                    updateLog: session.peerconnection.updateLog,
337
+                    stats: session.peerconnection.stats,
338
+                    url: window.location.href
339
+                };
340
+            }
341
+        });
342
+        return data;
324 343
     }
325 344
 });

+ 23
- 3
modules/UI/UI.js Datei anzeigen

@@ -551,16 +551,36 @@ UI.generateRoomName = function() {
551 551
 UI.connectionIndicatorShowMore = function(id)
552 552
 {
553 553
     return VideoLayout.connectionIndicators[id].showMore();
554
-}
554
+};
555 555
 
556 556
 UI.showToolbar = function () {
557 557
     return ToolbarToggler.showToolbar();
558
-}
558
+};
559 559
 
560 560
 UI.dockToolbar = function (isDock) {
561 561
     return ToolbarToggler.dockToolbar(isDock);
562
-}
562
+};
563
+
563 564
 
565
+function dump(elem, filename) {
566
+    elem = elem.parentNode;
567
+    elem.download = filename || 'meetlog.json';
568
+    elem.href = 'data:application/json;charset=utf-8,\n';
569
+    var data = {};
570
+    if (connection.jingle) {
571
+        data = connection.jingle.populateData();
572
+    }
573
+    var metadata = {};
574
+    metadata.time = new Date();
575
+    metadata.url = window.location.href;
576
+    metadata.ua = navigator.userAgent;
577
+    if (connection.logger) {
578
+        metadata.xmpp = connection.logger.log;
579
+    }
580
+    data.metadata = metadata;
581
+    elem.href += encodeURIComponent(JSON.stringify(data, null, '  '));
582
+    return false;
583
+}
564 584
 
565 585
 module.exports = UI;
566 586
 

+ 2
- 2
modules/UI/side_pannels/SidePanelToggler.js Datei anzeigen

@@ -29,10 +29,10 @@ var PanelToggler = (function(my) {
29 29
         var videospaceWidth = window.innerWidth - panelSize[0];
30 30
         var videospaceHeight = window.innerHeight;
31 31
         var videoSize
32
-            = getVideoSize(null, null, videospaceWidth, videospaceHeight);
32
+            = VideoLayout.getVideoSize(null, null, videospaceWidth, videospaceHeight);
33 33
         var videoWidth = videoSize[0];
34 34
         var videoHeight = videoSize[1];
35
-        var videoPosition = getVideoPosition(videoWidth,
35
+        var videoPosition = VideoLayout.getVideoPosition(videoWidth,
36 36
             videoHeight,
37 37
             videospaceWidth,
38 38
             videospaceHeight);

+ 1
- 2
modules/UI/side_pannels/chat/Chat.js Datei anzeigen

@@ -1,5 +1,4 @@
1
-/* global $, Util, connection, nickname:true, getVideoSize,
2
-getVideoPosition, showToolbar */
1
+/* global $, Util, connection, nickname:true, showToolbar */
3 2
 var Replacement = require("./Replacement");
4 3
 var CommandsProcessor = require("./Commands");
5 4
 var ToolbarToggler = require("../../toolbars/ToolbarToggler");

+ 8
- 8
modules/UI/videolayout/VideoLayout.js Datei anzeigen

@@ -16,10 +16,6 @@ var largeVideoState = {
16 16
     newSrc: ''
17 17
 };
18 18
 
19
-// By default we use camera
20
-var getVideoSize = getCameraVideoSize;
21
-var getVideoPosition = getCameraVideoPosition;
22
-
23 19
 var defaultLocalDisplayName = "Me";
24 20
 
25 21
 /**
@@ -407,6 +403,10 @@ function createModeratorIndicatorElement(parentElement) {
407 403
 var VideoLayout = (function (my) {
408 404
     my.connectionIndicators = {};
409 405
 
406
+    // By default we use camera
407
+    my.getVideoSize = getCameraVideoSize;
408
+    my.getVideoPosition = getCameraVideoPosition;
409
+
410 410
     my.isInLastN = function(resource) {
411 411
         return lastNCount < 0 // lastN is disabled, return true
412 412
             || (lastNCount > 0 && lastNEndpointsCache.length == 0) // lastNEndpoints cache not built yet, return true
@@ -692,10 +692,10 @@ var VideoLayout = (function (my) {
692 692
 
693 693
                     // Change the way we'll be measuring and positioning large video
694 694
 
695
-                    getVideoSize = largeVideoState.isDesktop
695
+                    VideoLayout.getVideoSize = largeVideoState.isDesktop
696 696
                         ? getDesktopVideoSize
697 697
                         : getCameraVideoSize;
698
-                    getVideoPosition = largeVideoState.isDesktop
698
+                    VideoLayout.getVideoPosition = largeVideoState.isDesktop
699 699
                         ? getDesktopVideoPosition
700 700
                         : getCameraVideoPosition;
701 701
 
@@ -829,7 +829,7 @@ var VideoLayout = (function (my) {
829 829
         var videoSpaceWidth = $('#videospace').width();
830 830
         var videoSpaceHeight = window.innerHeight;
831 831
 
832
-        var videoSize = getVideoSize(videoWidth,
832
+        var videoSize = VideoLayout.getVideoSize(videoWidth,
833 833
                                      videoHeight,
834 834
                                      videoSpaceWidth,
835 835
                                      videoSpaceHeight);
@@ -837,7 +837,7 @@ var VideoLayout = (function (my) {
837 837
         var largeVideoWidth = videoSize[0];
838 838
         var largeVideoHeight = videoSize[1];
839 839
 
840
-        var videoPosition = getVideoPosition(largeVideoWidth,
840
+        var videoPosition = VideoLayout.getVideoPosition(largeVideoWidth,
841 841
                                              largeVideoHeight,
842 842
                                              videoSpaceWidth,
843 843
                                              videoSpaceHeight);

Laden…
Abbrechen
Speichern