浏览代码

Fixes issue with switching to the screen stream before conference starts(when we're still alone in the room).

j8
paweldomas 9 年前
父节点
当前提交
6ec7be09f2
共有 6 个文件被更改,包括 27 次插入15 次删除
  1. 1
    1
      index.html
  2. 13
    7
      libs/app.bundle.js
  3. 3
    0
      modules/RTC/RTC.js
  4. 4
    1
      modules/UI/videolayout/VideoLayout.js
  5. 0
    3
      modules/xmpp/JingleSession.js
  6. 6
    3
      modules/xmpp/xmpp.js

+ 1
- 1
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=97"></script>
25
+    <script src="libs/app.bundle.js?v=98"></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">

+ 13
- 7
libs/app.bundle.js 查看文件

@@ -1325,6 +1325,9 @@ var RTC = {
1325 1325
         this.localVideo = this.createLocalStream(videoStream, "video", true, type);
1326 1326
         // Stop the stream to trigger onended event for old stream
1327 1327
         oldStream.stop();
1328
+
1329
+        this.switchVideoStreams(videoStream, oldStream);
1330
+
1328 1331
         APP.xmpp.switchStreams(videoStream, oldStream,localCallback);
1329 1332
     },
1330 1333
     changeLocalAudio: function (stream, callback) {
@@ -8591,7 +8594,10 @@ var VideoLayout = (function (my) {
8591 8594
 
8592 8595
         localVideoThumbnail.changeVideo(stream, isMuted);
8593 8596
 
8594
-        LargeVideo.updateLargeVideo(APP.xmpp.myResource());
8597
+        LargeVideo.updateLargeVideo(
8598
+            APP.xmpp.myResource(),
8599
+            /* force update only before conference starts */
8600
+            !APP.xmpp.isConferenceInProgress());
8595 8601
 
8596 8602
     };
8597 8603
 
@@ -12768,9 +12774,6 @@ JingleSession.prototype.switchStreams = function (new_stream, oldStream, success
12768 12774
             self.peerconnection.addStream(new_stream);
12769 12775
     }
12770 12776
 
12771
-    if(!isAudio)
12772
-    APP.RTC.switchVideoStreams(new_stream, oldStream);
12773
-
12774 12777
     // Conference is not active
12775 12778
     if(!oldSdp || !self.peerconnection) {
12776 12779
         success_callback();
@@ -16846,8 +16849,12 @@ var XMPP = {
16846 16849
     isExternalAuthEnabled: function () {
16847 16850
         return Moderator.isExternalAuthEnabled();
16848 16851
     },
16852
+    isConferenceInProgress: function () {
16853
+        return connection && connection.jingle.activecall &&
16854
+            connection.jingle.activecall.peerconnection;
16855
+    },
16849 16856
     switchStreams: function (stream, oldStream, callback, isAudio) {
16850
-        if (connection && connection.jingle.activecall) {
16857
+        if (this.isConferenceInProgress()) {
16851 16858
             // FIXME: will block switchInProgress on true value in case of exception
16852 16859
             connection.jingle.activecall.switchStreams(stream, oldStream, callback, isAudio);
16853 16860
         } else {
@@ -17085,8 +17092,7 @@ var XMPP = {
17085 17092
         return connection.jingle.sessions;
17086 17093
     },
17087 17094
     removeStream: function (stream) {
17088
-        if(!connection || !connection.jingle.activecall ||
17089
-            !connection.jingle.activecall.peerconnection)
17095
+        if (!this.isConferenceInProgress())
17090 17096
             return;
17091 17097
         connection.jingle.activecall.peerconnection.removeStream(stream);
17092 17098
     }

+ 3
- 0
modules/RTC/RTC.js 查看文件

@@ -215,6 +215,9 @@ var RTC = {
215 215
         this.localVideo = this.createLocalStream(videoStream, "video", true, type);
216 216
         // Stop the stream to trigger onended event for old stream
217 217
         oldStream.stop();
218
+
219
+        this.switchVideoStreams(videoStream, oldStream);
220
+
218 221
         APP.xmpp.switchStreams(videoStream, oldStream,localCallback);
219 222
     },
220 223
     changeLocalAudio: function (stream, callback) {

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

@@ -64,7 +64,10 @@ var VideoLayout = (function (my) {
64 64
 
65 65
         localVideoThumbnail.changeVideo(stream, isMuted);
66 66
 
67
-        LargeVideo.updateLargeVideo(APP.xmpp.myResource());
67
+        LargeVideo.updateLargeVideo(
68
+            APP.xmpp.myResource(),
69
+            /* force update only before conference starts */
70
+            !APP.xmpp.isConferenceInProgress());
68 71
 
69 72
     };
70 73
 

+ 0
- 3
modules/xmpp/JingleSession.js 查看文件

@@ -1020,9 +1020,6 @@ JingleSession.prototype.switchStreams = function (new_stream, oldStream, success
1020 1020
             self.peerconnection.addStream(new_stream);
1021 1021
     }
1022 1022
 
1023
-    if(!isAudio)
1024
-    APP.RTC.switchVideoStreams(new_stream, oldStream);
1025
-
1026 1023
     // Conference is not active
1027 1024
     if(!oldSdp || !self.peerconnection) {
1028 1025
         success_callback();

+ 6
- 3
modules/xmpp/xmpp.js 查看文件

@@ -362,8 +362,12 @@ var XMPP = {
362 362
     isExternalAuthEnabled: function () {
363 363
         return Moderator.isExternalAuthEnabled();
364 364
     },
365
+    isConferenceInProgress: function () {
366
+        return connection && connection.jingle.activecall &&
367
+            connection.jingle.activecall.peerconnection;
368
+    },
365 369
     switchStreams: function (stream, oldStream, callback, isAudio) {
366
-        if (connection && connection.jingle.activecall) {
370
+        if (this.isConferenceInProgress()) {
367 371
             // FIXME: will block switchInProgress on true value in case of exception
368 372
             connection.jingle.activecall.switchStreams(stream, oldStream, callback, isAudio);
369 373
         } else {
@@ -601,8 +605,7 @@ var XMPP = {
601 605
         return connection.jingle.sessions;
602 606
     },
603 607
     removeStream: function (stream) {
604
-        if(!connection || !connection.jingle.activecall ||
605
-            !connection.jingle.activecall.peerconnection)
608
+        if (!this.isConferenceInProgress())
606 609
             return;
607 610
         connection.jingle.activecall.peerconnection.removeStream(stream);
608 611
     }

正在加载...
取消
保存