Bläddra i källkod

Removes some dependancies from functions in app.js.

master
hristoterezov 10 år sedan
förälder
incheckning
27502d3fa8

+ 3
- 58
app.js Visa fil

44
 var isFullScreen = false;
44
 var isFullScreen = false;
45
 var currentVideoWidth = null;
45
 var currentVideoWidth = null;
46
 var currentVideoHeight = null;
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
 var sessionTerminated = false;
48
 var sessionTerminated = false;
61
 
49
 
624
     return isDesktop;
612
     return isDesktop;
625
 }
613
 }
626
 
614
 
627
-function getConferenceHandler() {
628
-    return activecall;
629
-}
630
-
631
 /**
615
 /**
632
  * Mutes/unmutes the local video.
616
  * Mutes/unmutes the local video.
633
  *
617
  *
639
  */
623
  */
640
 function setVideoMute(mute, options) {
624
 function setVideoMute(mute, options) {
641
     if (connection && connection.jingle.localVideo) {
625
     if (connection && connection.jingle.localVideo) {
642
-        var session = getConferenceHandler();
626
+        var session = activecall;
643
 
627
 
644
         if (session) {
628
         if (session) {
645
             session.setVideoMute(
629
             session.setVideoMute(
677
     buttonClick("#video", "icon-camera icon-camera-disabled");
661
     buttonClick("#video", "icon-camera icon-camera-disabled");
678
 
662
 
679
     if (connection && connection.jingle.localVideo) {
663
     if (connection && connection.jingle.localVideo) {
680
-        var session = getConferenceHandler();
664
+        var session = activecall;
681
 
665
 
682
         if (session) {
666
         if (session) {
683
             setVideoMute(!session.isVideoMute());
667
             setVideoMute(!session.isVideoMute());
793
 
777
 
794
 function disposeConference(onUnload) {
778
 function disposeConference(onUnload) {
795
     UI.onDisposeConference(onUnload);
779
     UI.onDisposeConference(onUnload);
796
-    var handler = getConferenceHandler();
780
+    var handler = activecall;
797
     if (handler && handler.peerconnection) {
781
     if (handler && handler.peerconnection) {
798
         // FIXME: probably removing streams is not required and close() should
782
         // FIXME: probably removing streams is not required and close() should
799
         // be enough
783
         // be enough
809
     activecall = null;
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
  * Changes the style class of the element given by id.
797
  * Changes the style class of the element given by id.
853
  */
798
  */

+ 2
- 3
desktopsharing.js Visa fil

260
 
260
 
261
     UI.changeLocalVideo(stream, !isUsingScreenStream);
261
     UI.changeLocalVideo(stream, !isUsingScreenStream);
262
 
262
 
263
-    var conferenceHandler = getConferenceHandler();
264
-    if (conferenceHandler) {
263
+    if (activecall) {
265
         // FIXME: will block switchInProgress on true value in case of exception
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
     } else {
266
     } else {
268
         // We are done immediately
267
         // We are done immediately
269
         console.error("No conference handler");
268
         console.error("No conference handler");

+ 19
- 0
libs/strophe/strophe.jingle.js Visa fil

321
             }
321
             }
322
         );
322
         );
323
         // implement push?
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 Visa fil

551
 UI.connectionIndicatorShowMore = function(id)
551
 UI.connectionIndicatorShowMore = function(id)
552
 {
552
 {
553
     return VideoLayout.connectionIndicators[id].showMore();
553
     return VideoLayout.connectionIndicators[id].showMore();
554
-}
554
+};
555
 
555
 
556
 UI.showToolbar = function () {
556
 UI.showToolbar = function () {
557
     return ToolbarToggler.showToolbar();
557
     return ToolbarToggler.showToolbar();
558
-}
558
+};
559
 
559
 
560
 UI.dockToolbar = function (isDock) {
560
 UI.dockToolbar = function (isDock) {
561
     return ToolbarToggler.dockToolbar(isDock);
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
 module.exports = UI;
585
 module.exports = UI;
566
 
586
 

+ 2
- 2
modules/UI/side_pannels/SidePanelToggler.js Visa fil

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

+ 1
- 2
modules/UI/side_pannels/chat/Chat.js Visa fil

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

+ 8
- 8
modules/UI/videolayout/VideoLayout.js Visa fil

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

Laddar…
Avbryt
Spara