瀏覽代碼

Moves LargeVideo html dependancies in LargeVideo.js

j8
hristoterezov 10 年之前
父節點
當前提交
baee96734c

+ 1
- 13
index.html 查看文件

@@ -22,7 +22,7 @@
22 22
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
23 23
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
24 24
     <script src="interface_config.js?v=5"></script>
25
-    <script src="libs/app.bundle.js?v=112"></script>
25
+    <script src="libs/app.bundle.js?v=113"></script>
26 26
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
27 27
     <link rel="stylesheet" href="css/font.css?v=7"/>
28 28
     <link rel="stylesheet" href="css/toastr.css?v=1">
@@ -225,18 +225,6 @@
225 225
         </div>
226 226
         <div id="reloadPresentation"><a id="reloadPresentationLink"><i title="Reload Prezi" class="fa fa-repeat fa-lg"></i></a></div>
227 227
         <div id="videospace">
228
-            <div id="largeVideoContainer" class="videocontainer">
229
-                <div id="presentation"></div>
230
-                <div id="etherpad"></div>
231
-                <a target="_new"><div class="watermark leftwatermark"></div></a>
232
-                <a target="_new"><div class="watermark rightwatermark"></div></a>
233
-                <a class="poweredby" href="http://jitsi.org" target="_new" ><span data-i18n="poweredby"></span> jitsi.org</a>
234
-                <div id="activeSpeaker">
235
-                    <img id="activeSpeakerAvatar" src=""/>
236
-                    <canvas id="activeSpeakerAudioLevel"></canvas>
237
-                </div>
238
-                <video id="largeVideo" autoplay oncontextmenu="return false;"></video>
239
-            </div>
240 228
             <div id="remoteVideos">
241 229
                 <span id="localVideoContainer" class="videocontainer">
242 230
                     <span id="localNick" class="nick"></span>

+ 29045
- 28882
libs/app.bundle.js
文件差異過大導致無法顯示
查看文件


+ 8
- 29
modules/UI/UI.js 查看文件

@@ -339,6 +339,10 @@ function registerListeners() {
339 339
     UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
340 340
         APP.xmpp.addToPresence("displayName", nickname);
341 341
     });
342
+
343
+    UI.addListener(UIEvents.LARGEVIDEO_INIT, function () {
344
+        AudioLevels.init();
345
+    });
342 346
 }
343 347
 
344 348
 
@@ -386,29 +390,6 @@ UI.start = function (init) {
386 390
         return;
387 391
     }
388 392
 
389
-    if (interfaceConfig.SHOW_JITSI_WATERMARK) {
390
-        var leftWatermarkDiv
391
-            = $("#largeVideoContainer div[class='watermark leftwatermark']");
392
-
393
-        leftWatermarkDiv.css({display: 'block'});
394
-        leftWatermarkDiv.parent().get(0).href
395
-            = interfaceConfig.JITSI_WATERMARK_LINK;
396
-    }
397
-
398
-    if (interfaceConfig.SHOW_BRAND_WATERMARK) {
399
-        var rightWatermarkDiv
400
-            = $("#largeVideoContainer div[class='watermark rightwatermark']");
401
-
402
-        rightWatermarkDiv.css({display: 'block'});
403
-        rightWatermarkDiv.parent().get(0).href
404
-            = interfaceConfig.BRAND_WATERMARK_LINK;
405
-        rightWatermarkDiv.get(0).style.backgroundImage
406
-            = "url(images/rightwatermark.png)";
407
-    }
408
-
409
-    if (interfaceConfig.SHOW_POWERED_BY) {
410
-        $("#largeVideoContainer>a[class='poweredby']").css({display: 'block'});
411
-    }
412 393
 
413 394
     $("#welcome_page").hide();
414 395
 
@@ -418,10 +399,12 @@ UI.start = function (init) {
418 399
     // Set the defaults for prompt dialogs.
419 400
     jQuery.prompt.setDefaults({persistent: false});
420 401
 
402
+
403
+    registerListeners();
404
+
421 405
     VideoLayout.init(eventEmitter);
422
-    AudioLevels.init();
423 406
     NicknameHandler.init(eventEmitter);
424
-    registerListeners();
407
+
425 408
     bindEvents();
426 409
     setupPrezi();
427 410
     setupToolbars();
@@ -452,10 +435,6 @@ UI.start = function (init) {
452 435
         $('#notice').css({display: 'block'});
453 436
     }
454 437
 
455
-    if (!RTCBrowserType.isIExplorer()) {
456
-        document.getElementById('largeVideo').volume = 0;
457
-    }
458
-
459 438
     if(config.requireDisplayName) {
460 439
         var currentSettings = Settings.getSettings();
461 440
         if (!currentSettings.displayName) {

+ 3
- 2
modules/UI/audio_levels/AudioLevels.js 查看文件

@@ -1,6 +1,6 @@
1 1
 var CanvasUtil = require("./CanvasUtils");
2 2
 
3
-var ASDrawContext = $('#activeSpeakerAudioLevel')[0].getContext('2d');
3
+var ASDrawContext = null;
4 4
 
5 5
 function initActiveSpeakerAudioLevels() {
6 6
     var ASRadius = interfaceConfig.ACTIVE_SPEAKER_AVATAR_SIZE / 2;
@@ -24,6 +24,7 @@ var AudioLevels = (function(my) {
24 24
     my.LOCAL_LEVEL = 'local';
25 25
 
26 26
     my.init = function () {
27
+        ASDrawContext = $('#activeSpeakerAudioLevel')[0].getContext('2d');
27 28
         initActiveSpeakerAudioLevels();
28 29
     }
29 30
 
@@ -120,7 +121,7 @@ var AudioLevels = (function(my) {
120 121
     };
121 122
 
122 123
     my.updateActiveSpeakerAudioLevel = function(audioLevel) {
123
-        if($("#activeSpeaker").css("visibility") == "hidden")
124
+        if($("#activeSpeaker").css("visibility") == "hidden" || ASDrawContext === null)
124 125
             return;
125 126
 
126 127
 

+ 22
- 72
modules/UI/etherpad/Etherpad.js 查看文件

@@ -38,31 +38,22 @@ function enableEtherpadButton() {
38 38
  * Creates the IFrame for the etherpad.
39 39
  */
40 40
 function createIFrame() {
41
-    etherpadIFrame = document.createElement('iframe');
42
-    etherpadIFrame.src = domain + etherpadName + options;
43
-    etherpadIFrame.frameBorder = 0;
44
-    etherpadIFrame.scrolling = "no";
45
-    etherpadIFrame.width = $('#largeVideoContainer').width() || 640;
46
-    etherpadIFrame.height = $('#largeVideoContainer').height() || 480;
47
-    etherpadIFrame.setAttribute('style', 'visibility: hidden;');
48
-
49
-    document.getElementById('etherpad').appendChild(etherpadIFrame);
50
-
51
-    etherpadIFrame.onload = function() {
52
-
53
-        document.domain = document.domain;
54
-        bubbleIframeMouseMove(etherpadIFrame);
55
-        setTimeout(function() {
56
-            // the iframes inside of the etherpad are
57
-            // not yet loaded when the etherpad iframe is loaded
58
-            var outer = etherpadIFrame.
59
-                contentDocument.getElementsByName("ace_outer")[0];
60
-            bubbleIframeMouseMove(outer);
61
-            var inner = outer.
62
-                contentDocument.getElementsByName("ace_inner")[0];
63
-            bubbleIframeMouseMove(inner);
64
-        }, 2000);
65
-    };
41
+    etherpadIFrame = VideoLayout.createEtherpadIframe(
42
+            domain + etherpadName + options, function() {
43
+
44
+                document.domain = document.domain;
45
+                bubbleIframeMouseMove(etherpadIFrame);
46
+                setTimeout(function() {
47
+                    // the iframes inside of the etherpad are
48
+                    // not yet loaded when the etherpad iframe is loaded
49
+                    var outer = etherpadIFrame.
50
+                        contentDocument.getElementsByName("ace_outer")[0];
51
+                    bubbleIframeMouseMove(outer);
52
+                    var inner = outer.
53
+                        contentDocument.getElementsByName("ace_inner")[0];
54
+                    bubbleIframeMouseMove(inner);
55
+                }, 2000);
56
+            });
66 57
 }
67 58
 
68 59
 function bubbleIframeMouseMove(iframe){
@@ -93,15 +84,6 @@ function bubbleIframeMouseMove(iframe){
93 84
 }
94 85
 
95 86
 
96
-/**
97
- * On video selected event.
98
- */
99
-$(document).bind('video.selected', function (event, isPresentation) {
100
-    if (config.etherpad_base && etherpadIFrame && etherpadIFrame.style.visibility !== 'hidden')
101
-        Etherpad.toggleEtherpad(isPresentation);
102
-});
103
-
104
-
105 87
 var Etherpad = {
106 88
     /**
107 89
      * Initializes the etherpad.
@@ -132,49 +114,17 @@ var Etherpad = {
132 114
         if (!etherpadIFrame)
133 115
             createIFrame();
134 116
 
135
-        var largeVideo = null;
136
-        if (Prezi.isPresentationVisible())
137
-            largeVideo = $('#presentation>iframe');
138
-        else
139
-            largeVideo = $('#largeVideo');
140
-
141
-        if ($('#etherpad>iframe').css('visibility') === 'hidden') {
142
-            $('#activeSpeaker').css('visibility', 'hidden');
143
-            largeVideo.fadeOut(300, function () {
144
-                if (Prezi.isPresentationVisible()) {
145
-                    largeVideo.css({opacity: '0'});
146
-                } else {
147
-                    VideoLayout.setLargeVideoVisible(false);
148
-                }
149
-            });
150 117
 
151
-            $('#etherpad>iframe').fadeIn(300, function () {
152
-                document.body.style.background = '#eeeeee';
153
-                $('#etherpad>iframe').css({visibility: 'visible'});
154
-                $('#etherpad').css({zIndex: 2});
155
-            });
118
+        if(VideoLayout.getLargeVideoState() === "etherpad")
119
+        {
120
+            VideoLayout.setLargeVideoState("video");
156 121
         }
157
-        else if ($('#etherpad>iframe')) {
158
-            $('#etherpad>iframe').fadeOut(300, function () {
159
-                $('#etherpad>iframe').css({visibility: 'hidden'});
160
-                $('#etherpad').css({zIndex: 0});
161
-                document.body.style.background = 'black';
162
-            });
163
-
164
-            if (!isPresentation) {
165
-                $('#largeVideo').fadeIn(300, function () {
166
-                    VideoLayout.setLargeVideoVisible(true);
167
-                });
168
-            }
122
+        else
123
+        {
124
+            VideoLayout.setLargeVideoState("etherpad");
169 125
         }
170 126
         resize();
171
-    },
172
-
173
-    isVisible: function() {
174
-        var etherpadIframe = $('#etherpad>iframe');
175
-        return etherpadIframe && etherpadIframe.is(':visible');
176 127
     }
177
-
178 128
 };
179 129
 
180 130
 module.exports = Etherpad;

+ 15
- 46
modules/UI/prezi/Prezi.js 查看文件

@@ -6,6 +6,20 @@ var PreziPlayer = require("./PreziPlayer");
6 6
 
7 7
 var preziPlayer = null;
8 8
 
9
+
10
+/**
11
+ * Shows/hides a presentation.
12
+ */
13
+function setPresentationVisible(visible) {
14
+
15
+    if (visible) {
16
+        VideoLayout.setLargeVideoState("prezi");
17
+    }
18
+    else {
19
+        VideoLayout.setLargeVideoState("video");
20
+    }
21
+}
22
+
9 23
 var Prezi = {
10 24
 
11 25
 
@@ -165,18 +179,14 @@ function presentationAdded(event, jid, presUrl, currentSlide) {
165 179
         + Strophe.getResourceFromJid(jid)
166 180
         + '_' + presId;
167 181
 
168
-
169
-
170
-
171 182
     VideoLayout.addPreziContainer(elementId);
172
-    VideoLayout.resizeThumbnails();
173 183
 
174 184
     var controlsEnabled = false;
175 185
     if (jid === APP.xmpp.myJid())
176 186
         controlsEnabled = true;
177 187
 
178 188
     setPresentationVisible(true);
179
-    $('#largeVideoContainer').hover(
189
+    VideoLayout.setLargeVideoHover(
180 190
         function (event) {
181 191
             if (Prezi.isPresentationVisible()) {
182 192
                 var reloadButtonRight = window.innerWidth
@@ -302,38 +312,6 @@ function resize() {
302 312
     }
303 313
 }
304 314
 
305
-/**
306
- * Shows/hides a presentation.
307
- */
308
-function setPresentationVisible(visible) {
309
-    var prezi = $('#presentation>iframe');
310
-    if (visible) {
311
-        // Trigger the video.selected event to indicate a change in the
312
-        // large video.
313
-        $(document).trigger("video.selected", [true]);
314
-
315
-        $('#largeVideo').fadeOut(300);
316
-        prezi.fadeIn(300, function() {
317
-            prezi.css({opacity:'1'});
318
-            ToolbarToggler.dockToolbar(true);
319
-            VideoLayout.setLargeVideoVisible(false);
320
-        });
321
-        $('#activeSpeaker').css('visibility', 'hidden');
322
-    }
323
-    else {
324
-        if (prezi.css('opacity') == '1') {
325
-            prezi.fadeOut(300, function () {
326
-                prezi.css({opacity:'0'});
327
-                $('#reloadPresentation').css({display:'none'});
328
-                $('#largeVideo').fadeIn(300, function() {
329
-                    VideoLayout.setLargeVideoVisible(true);
330
-                    ToolbarToggler.dockToolbar(false);
331
-                });
332
-            });
333
-        }
334
-    }
335
-}
336
-
337 315
 /**
338 316
  * Presentation has been removed.
339 317
  */
@@ -358,15 +336,6 @@ $(document).bind('gotoslide.muc', function (event, jid, presUrl, current) {
358 336
     }
359 337
 });
360 338
 
361
-/**
362
- * On video selected event.
363
- */
364
-$(document).bind('video.selected', function (event, isPresentation) {
365
-    if (!isPresentation && $('#presentation>iframe')) {
366
-        setPresentationVisible(false);
367
-    }
368
-});
369
-
370 339
 $(window).resize(function () {
371 340
     resize();
372 341
 });

+ 241
- 9
modules/UI/videolayout/LargeVideo.js 查看文件

@@ -3,6 +3,7 @@ var RTCBrowserType = require("../../RTC/RTCBrowserType");
3 3
 var UIUtil = require("../util/UIUtil");
4 4
 var UIEvents = require("../../../service/UI/UIEvents");
5 5
 var xmpp = require("../../xmpp/xmpp");
6
+var ToolbarToggler = require("../toolbars/ToolbarToggler");
6 7
 
7 8
 // FIXME: With Temasys we have to re-select everytime
8 9
 //var video = $('#largeVideo');
@@ -12,9 +13,45 @@ var currentVideoHeight = null;
12 13
 // By default we use camera
13 14
 var getVideoSize = getCameraVideoSize;
14 15
 var getVideoPosition = getCameraVideoPosition;
16
+/**
17
+ * The small video instance that is displayed in the large video
18
+ * @type {SmallVideo}
19
+ */
15 20
 var currentSmallVideo = null;
21
+/**
22
+ * Indicates whether the large video is enabled.
23
+ * @type {boolean}
24
+ */
25
+var isEnabled = true;
26
+/**
27
+ * Current large video state.
28
+ * Possible values - video, prezi or etherpad.
29
+ * @type {string}
30
+ */
31
+var state = "video";
16 32
 
17
-
33
+/**
34
+ * Returns the html element associated with the passed state of large video
35
+ * @param state the state.
36
+ * @returns {JQuery|*|jQuery|HTMLElement} the container.
37
+ */
38
+function getContainerByState(state)
39
+{
40
+    var selector = null;
41
+    switch (state)
42
+    {
43
+        case "video":
44
+            selector = "#largeVideo";
45
+            break;
46
+        case "etherpad":
47
+            selector = "#etherpad>iframe";
48
+            break;
49
+        case "prezi":
50
+            selector = "#presentation>iframe";
51
+            break;
52
+    }
53
+    return (selector !== null)? $(selector) : null;
54
+}
18 55
 
19 56
 /**
20 57
  * Sets the size and position of the given video element.
@@ -204,6 +241,10 @@ function updateActiveSpeakerAvatarSrc() {
204 241
     }
205 242
 }
206 243
 
244
+/**
245
+ * Change the video source of the large video.
246
+ * @param isVisible
247
+ */
207 248
 function changeVideo(isVisible) {
208 249
 
209 250
     if (!currentSmallVideo) {
@@ -248,11 +289,66 @@ function changeVideo(isVisible) {
248 289
     }
249 290
 }
250 291
 
292
+/**
293
+ * Creates the html elements for the large video.
294
+ */
295
+function createLargeVideoHTML()
296
+{
297
+    var html = '<div id="largeVideoContainer" class="videocontainer">';
298
+    html += '<div id="presentation"></div>' +
299
+            '<div id="etherpad"></div>' +
300
+            '<a target="_new"><div class="watermark leftwatermark"></div></a>' +
301
+            '<a target="_new"><div class="watermark rightwatermark"></div></a>' +
302
+            '<a class="poweredby" href="http://jitsi.org" target="_new" >' +
303
+                '<span data-i18n="poweredby"></span> jitsi.org' +
304
+            '</a>'+
305
+            '<div id="activeSpeaker">' +
306
+                '<img id="activeSpeakerAvatar" src=""/>' +
307
+                '<canvas id="activeSpeakerAudioLevel"></canvas>' +
308
+            '</div>' +
309
+            '<video id="largeVideo" autoplay oncontextmenu="return false;"></video>';
310
+    html += '</div>';
311
+    $(html).prependTo("#videospace");
312
+
313
+    if (interfaceConfig.SHOW_JITSI_WATERMARK) {
314
+        var leftWatermarkDiv
315
+            = $("#largeVideoContainer div[class='watermark leftwatermark']");
316
+
317
+        leftWatermarkDiv.css({display: 'block'});
318
+        leftWatermarkDiv.parent().get(0).href
319
+            = interfaceConfig.JITSI_WATERMARK_LINK;
320
+    }
321
+
322
+    if (interfaceConfig.SHOW_BRAND_WATERMARK) {
323
+        var rightWatermarkDiv
324
+            = $("#largeVideoContainer div[class='watermark rightwatermark']");
325
+
326
+        rightWatermarkDiv.css({display: 'block'});
327
+        rightWatermarkDiv.parent().get(0).href
328
+            = interfaceConfig.BRAND_WATERMARK_LINK;
329
+        rightWatermarkDiv.get(0).style.backgroundImage
330
+            = "url(images/rightwatermark.png)";
331
+    }
332
+
333
+    if (interfaceConfig.SHOW_POWERED_BY) {
334
+        $("#largeVideoContainer>a[class='poweredby']").css({display: 'block'});
335
+    }
336
+
337
+    if (!RTCBrowserType.isIExplorer()) {
338
+        $('#largeVideo').volume = 0;
339
+    }
340
+}
341
+
251 342
 var LargeVideo = {
252 343
 
253 344
     init: function (VideoLayout, emitter) {
345
+        if(!isEnabled)
346
+            return;
347
+        createLargeVideoHTML();
348
+
254 349
         this.VideoLayout = VideoLayout;
255 350
         this.eventEmitter = emitter;
351
+        this.eventEmitter.emit(UIEvents.LARGEVIDEO_INIT);
256 352
         var self = this;
257 353
         // Listen for large video size updates
258 354
         var largeVideo = $('#largeVideo')[0];
@@ -285,6 +381,8 @@ var LargeVideo = {
285 381
      * Updates the large video with the given new video source.
286 382
      */
287 383
     updateLargeVideo: function (resourceJid, forceUpdate) {
384
+        if(!isEnabled)
385
+            return;
288 386
         var newSmallVideo = this.VideoLayout.getSmallVideo(resourceJid);
289 387
         console.log('hover in ' + resourceJid + ', video: ', newSmallVideo);
290 388
 
@@ -324,6 +422,8 @@ var LargeVideo = {
324 422
      * Shows/hides the large video.
325 423
      */
326 424
     setLargeVideoVisible: function(isVisible) {
425
+        if(!isEnabled)
426
+            return;
327 427
         if (isVisible) {
328 428
             $('#largeVideo').css({visibility: 'visible'});
329 429
             $('.watermark').css({visibility: 'visible'});
@@ -339,6 +439,8 @@ var LargeVideo = {
339 439
         }
340 440
     },
341 441
     onVideoTypeChanged: function (jid) {
442
+        if(!isEnabled)
443
+            return;
342 444
         var resourceJid = Strophe.getResourceFromJid(jid);
343 445
         if (LargeVideo.isCurrentlyOnLarge(resourceJid))
344 446
         {
@@ -360,6 +462,8 @@ var LargeVideo = {
360 462
      */
361 463
     position: function (videoWidth, videoHeight,
362 464
                         videoSpaceWidth, videoSpaceHeight, animate) {
465
+        if(!isEnabled)
466
+            return;
363 467
         if(!videoSpaceWidth)
364 468
             videoSpaceWidth = $('#videospace').width();
365 469
         if(!videoSpaceHeight)
@@ -386,13 +490,9 @@ var LargeVideo = {
386 490
             largeVideoHeight,
387 491
             horizontalIndent, verticalIndent, animate);
388 492
     },
389
-
390
-    isLargeVideoOnTop: function () {
391
-        var Etherpad = require("../etherpad/Etherpad");
392
-        var Prezi = require("../prezi/Prezi");
393
-        return !Prezi.isPresentationVisible() && !Etherpad.isVisible();
394
-    },
395 493
     resize: function (animate, isVisible, completeFunction) {
494
+        if(!isEnabled)
495
+            return;
396 496
         var availableHeight = window.innerHeight;
397 497
         var availableWidth = UIUtil.getAvailableVideoWidth(isVisible);
398 498
 
@@ -437,6 +537,8 @@ var LargeVideo = {
437 537
 
438 538
     },
439 539
     resizeVideoAreaAnimated: function (isVisible, completeFunction) {
540
+        if(!isEnabled)
541
+            return;
440 542
         var size = this.resize(true, isVisible, completeFunction);
441 543
         this.position(null, null, size[0], size[1], true);
442 544
     },
@@ -444,22 +546,152 @@ var LargeVideo = {
444 546
         return currentSmallVideo ? currentSmallVideo.getResourceJid() : null;
445 547
     },
446 548
     updateAvatar: function (resourceJid) {
549
+        if(!isEnabled)
550
+            return;
447 551
         if (resourceJid === this.getResourceJid()) {
448 552
             updateActiveSpeakerAvatarSrc();
449 553
         }
450 554
     },
451 555
     showAvatar: function (resourceJid, show) {
556
+        if(!isEnabled)
557
+            return;
452 558
         if(this.getResourceJid() === resourceJid
453
-            && LargeVideo.isLargeVideoOnTop())
559
+            && state === "video")
454 560
         {
455 561
             $("#largeVideo").css("visibility", show ? "hidden" : "visible");
456 562
             $('#activeSpeaker').css("visibility", show ? "visible" : "hidden");
457 563
             return true;
458 564
         }
459 565
         return false;
566
+    },
567
+    /**
568
+     * Disables the large video
569
+     */
570
+    disable: function () {
571
+        isEnabled = false;
572
+    },
573
+    /**
574
+     * Enables the large video
575
+     */
576
+    enable: function () {
577
+        isEnabled = true;
578
+    },
579
+    /**
580
+     * Returns true if the video is enabled.
581
+     */
582
+    isEnabled: function () {
583
+        return isEnabled;
584
+    },
585
+    /**
586
+     * Creates the iframe used by the etherpad
587
+     * @param src the value for src attribute
588
+     * @param onloadHandler handler executed when the iframe loads it content
589
+     * @returns {HTMLElement} the iframe
590
+     */
591
+    createEtherpadIframe: function (src, onloadHandler) {
592
+        if(!isEnabled)
593
+            return;
594
+
595
+        var etherpadIFrame = document.createElement('iframe');
596
+        etherpadIFrame.src = src;
597
+        etherpadIFrame.frameBorder = 0;
598
+        etherpadIFrame.scrolling = "no";
599
+        etherpadIFrame.width = $('#largeVideoContainer').width() || 640;
600
+        etherpadIFrame.height = $('#largeVideoContainer').height() || 480;
601
+        etherpadIFrame.setAttribute('style', 'visibility: hidden;');
602
+
603
+        document.getElementById('etherpad').appendChild(etherpadIFrame);
604
+
605
+        etherpadIFrame.onload = onloadHandler;
606
+
607
+        return etherpadIFrame;
608
+    },
609
+    /**
610
+     * Changes the state of the large video.
611
+     * Possible values - video, prezi, etherpad.
612
+     * @param newState - the new state
613
+     */
614
+    setState: function (newState) {
615
+        if(state === newState)
616
+            return;
617
+        var currentContainer = getContainerByState(state);
618
+        if(!currentContainer)
619
+            return;
620
+
621
+        var self = this;
622
+        var oldState = state;
623
+
624
+        switch (newState)
625
+        {
626
+            case "etherpad":
627
+                $('#activeSpeaker').css('visibility', 'hidden');
628
+                currentContainer.fadeOut(300, function () {
629
+                    if (oldState === "prezi") {
630
+                        currentContainer.css({opacity: '0'});
631
+                        $('#reloadPresentation').css({display: 'none'});
632
+                    }
633
+                    else {
634
+                        self.setLargeVideoVisible(false);
635
+                    }
636
+                });
637
+
638
+                $('#etherpad>iframe').fadeIn(300, function () {
639
+                    document.body.style.background = '#eeeeee';
640
+                    $('#etherpad>iframe').css({visibility: 'visible'});
641
+                    $('#etherpad').css({zIndex: 2});
642
+                });
643
+                break;
644
+            case "prezi":
645
+                var prezi = $('#presentation>iframe');
646
+                currentContainer.fadeOut(300, function() {
647
+                    document.body.style.background = 'black';
648
+                });
649
+                prezi.fadeIn(300, function() {
650
+                    prezi.css({opacity:'1'});
651
+                    ToolbarToggler.dockToolbar(true);//fix that
652
+                    self.setLargeVideoVisible(false);
653
+                    $('#etherpad>iframe').css({visibility: 'hidden'});
654
+                    $('#etherpad').css({zIndex: 0});
655
+                });
656
+                $('#activeSpeaker').css('visibility', 'hidden');
657
+                break;
658
+
659
+            case "video":
660
+                currentContainer.fadeOut(300, function () {
661
+                    $('#presentation>iframe').css({opacity:'0'});
662
+                    $('#reloadPresentation').css({display:'none'});
663
+                    $('#etherpad>iframe').css({visibility: 'hidden'});
664
+                    $('#etherpad').css({zIndex: 0});
665
+                    document.body.style.background = 'black';
666
+                    ToolbarToggler.dockToolbar(false);//fix that
667
+                });
668
+                $('#largeVideo').fadeIn(300, function () {
669
+                    self.setLargeVideoVisible(true);
670
+                });
671
+                break;
672
+        }
673
+
674
+        state = newState;
675
+
676
+    },
677
+    /**
678
+     * Returns the current state of the large video.
679
+     * @returns {string} the current state - video, prezi or etherpad.
680
+     */
681
+    getState: function () {
682
+        return state;
683
+    },
684
+    /**
685
+     * Sets hover handlers for the large video container div.
686
+     * @param inHandler
687
+     * @param outHandler
688
+     */
689
+    setHover: function(inHandler, outHandler)
690
+    {
691
+        $('#largeVideoContainer').hover(inHandler, outHandler);
460 692
     }
461 693
 
462
-}
694
+};
463 695
 
464 696
 
465 697
 module.exports = LargeVideo;

+ 1
- 1
modules/UI/videolayout/SmallVideo.js 查看文件

@@ -210,7 +210,7 @@ SmallVideo.prototype.enableDominantSpeaker = function (isEnable)
210 210
     }
211 211
 
212 212
     if (isEnable) {
213
-        this.showDisplayName(LargeVideo.isLargeVideoOnTop());
213
+        this.showDisplayName(LargeVideo.getState() === "video");
214 214
 
215 215
         if (!this.container.classList.contains("dominantspeaker"))
216 216
             this.container.classList.add("dominantspeaker");

+ 28
- 11
modules/UI/videolayout/VideoLayout.js 查看文件

@@ -1,5 +1,4 @@
1 1
 var AudioLevels = require("../audio_levels/AudioLevels");
2
-var Avatar = require("../avatar/Avatar");
3 2
 var ContactList = require("../side_pannels/contactlist/ContactList");
4 3
 var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");
5 4
 var UIEvents = require("../../../service/UI/UIEvents");
@@ -14,9 +13,6 @@ var LocalVideo = require("./LocalVideo");
14 13
 var remoteVideos = {};
15 14
 var localVideoThumbnail = null;
16 15
 
17
-
18
-
19
-
20 16
 var currentDominantSpeaker = null;
21 17
 var lastNCount = config.channelLastN;
22 18
 var localLastNCount = config.channelLastN;
@@ -26,6 +22,8 @@ var lastNPickupJid = null;
26 22
 
27 23
 var eventEmitter = null;
28 24
 
25
+var showLargeVideo = true;
26
+
29 27
 
30 28
 /**
31 29
  * Currently focused video jid
@@ -37,8 +35,10 @@ var VideoLayout = (function (my) {
37 35
     my.init = function (emitter) {
38 36
         eventEmitter = emitter;
39 37
         localVideoThumbnail = new LocalVideo(VideoLayout);
40
-        VideoLayout.resizeLargeVideoContainer();
38
+
41 39
         LargeVideo.init(VideoLayout, emitter);
40
+        VideoLayout.resizeLargeVideoContainer();
41
+
42 42
     };
43 43
 
44 44
     my.isInLastN = function(resource) {
@@ -232,9 +232,7 @@ var VideoLayout = (function (my) {
232 232
             }
233 233
         }
234 234
 
235
-        // Triggers a "video.selected" event. The "false" parameter indicates
236
-        // this isn't a prezi.
237
-        $(document).trigger("video.selected", [false]);
235
+        LargeVideo.setState("video");
238 236
 
239 237
         LargeVideo.updateLargeVideo(resourceJid);
240 238
 
@@ -583,11 +581,11 @@ var VideoLayout = (function (my) {
583 581
             var currentJID = APP.xmpp.findJidFromResource(currentDominantSpeaker);
584 582
             var newJID = APP.xmpp.findJidFromResource(resourceJid);
585 583
             if(currentDominantSpeaker && (!members || !members[currentJID] ||
586
-                !members[currentJID].displayName)) {
584
+                !members[currentJID].displayName) && remoteVideos[resourceJid]) {
587 585
                 remoteVideos[resourceJid].setDisplayName(null);
588 586
             }
589 587
             if(resourceJid && (!members || !members[newJID] ||
590
-                !members[newJID].displayName)) {
588
+                !members[newJID].displayName) && remoteVideos[resourceJid]) {
591 589
                 remoteVideos[resourceJid].setDisplayName(null,
592 590
                     interfaceConfig.DEFAULT_DOMINANT_SPEAKER_DISPLAY_NAME);
593 591
             }
@@ -855,7 +853,9 @@ var VideoLayout = (function (my) {
855 853
     };
856 854
 
857 855
     my.addPreziContainer = function (id) {
858
-        return RemoteVideo.createContainer(id);
856
+        var container = RemoteVideo.createContainer(id);
857
+        VideoLayout.resizeThumbnails();
858
+        return container;
859 859
     };
860 860
 
861 861
     my.setLargeVideoVisible = function (isVisible) {
@@ -905,6 +905,23 @@ var VideoLayout = (function (my) {
905 905
         LargeVideo.updateAvatar(resourceJid, thumbUrl);
906 906
     };
907 907
 
908
+    my.createEtherpadIframe = function(src, onloadHandler)
909
+    {
910
+        return LargeVideo.createEtherpadIframe(src, onloadHandler);
911
+    };
912
+
913
+    my.setLargeVideoState = function (state) {
914
+        LargeVideo.setState(state);
915
+    };
916
+
917
+    my.getLargeVideoState = function () {
918
+        return LargeVideo.getState();
919
+    };
920
+
921
+    my.setLargeVideoHover = function (inHandler, outHandler) {
922
+        LargeVideo.setHover(inHandler, outHandler);
923
+    };
924
+
908 925
     return my;
909 926
 }(VideoLayout || {}));
910 927
 

+ 2
- 1
service/UI/UIEvents.js 查看文件

@@ -1,6 +1,7 @@
1 1
 var UIEvents = {
2 2
     NICKNAME_CHANGED: "UI.nickname_changed",
3 3
     SELECTED_ENDPOINT: "UI.selected_endpoint",
4
-    PINNED_ENDPOINT: "UI.pinned_endpoint"
4
+    PINNED_ENDPOINT: "UI.pinned_endpoint",
5
+    LARGEVIDEO_INIT: "UI.largevideo_init"
5 6
 };
6 7
 module.exports = UIEvents;

Loading…
取消
儲存