瀏覽代碼

Fixes call to undefined method(which fixes crash on lastN switch and when clicking contact on the contactlist).

j8
paweldomas 10 年之前
父節點
當前提交
420bbe136c
共有 4 個文件被更改,包括 71 次插入64 次删除
  1. 1
    1
      index.html
  2. 35
    36
      libs/app.bundle.js
  3. 33
    25
      modules/UI/videolayout/RemoteVideo.js
  4. 2
    2
      modules/UI/videolayout/VideoLayout.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=101"></script>
25
+    <script src="libs/app.bundle.js?v=102"></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">

+ 35
- 36
libs/app.bundle.js 查看文件

@@ -9511,6 +9511,37 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
9511 9511
         this.VideoLayout.updateRemovedVideo(this.resourceJid);
9512 9512
 };
9513 9513
 
9514
+RemoteVideo.prototype.waitForPlayback = function (stream) {
9515
+
9516
+    var isVideo = stream.getVideoTracks().length > 0;
9517
+    if (!isVideo || stream.id === 'mixedmslabel') {
9518
+        return;
9519
+    }
9520
+
9521
+    var self = this;
9522
+    var sel = this.VideoLayout.getPeerVideoSel(this.resourceJid);
9523
+
9524
+    // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
9525
+    // when video playback starts
9526
+    var onPlayingHandler = function () {
9527
+        // FIXME: why do i have to do this for FF?
9528
+        if (RTCBrowserType.isFirefox()) {
9529
+            APP.RTC.attachMediaStream(sel, stream);
9530
+        }
9531
+        if (RTCBrowserType.isTemasysPluginUsed()) {
9532
+            sel = $('#' + newElementId);
9533
+        }
9534
+        self.VideoLayout.videoactive(sel, self.resourceJid);
9535
+        sel[0].onplaying = null;
9536
+        if (RTCBrowserType.isTemasysPluginUsed()) {
9537
+            // 'currentTime' is used to check if the video has started
9538
+            // and the value is not set by the plugin, so we do it
9539
+            sel[0].currentTime = 1;
9540
+        }
9541
+    };
9542
+    sel[0].onplaying = onPlayingHandler;
9543
+};
9544
+
9514 9545
 RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
9515 9546
     if (!this.container)
9516 9547
         return;
@@ -9526,35 +9557,12 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
9526 9557
     sel.hide();
9527 9558
 
9528 9559
     // If the container is currently visible we attach the stream.
9529
-    if (!isVideo
9530
-        || (this.container.offsetParent !== null && isVideo)) {
9531
-
9532
-        // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
9533
-        // when video playback starts
9534
-        if (isVideo && stream.id !== 'mixedmslabel') {
9535
-            var onPlayingHandler = function () {
9536
-                // FIXME: why do i have to do this for FF?
9537
-                if (RTCBrowserType.isFirefox()) {
9538
-                    APP.RTC.attachMediaStream(sel, stream);
9539
-                }
9540
-                if (RTCBrowserType.isTemasysPluginUsed()) {
9541
-                    sel = $('#' + newElementId);
9542
-                }
9543
-                self.VideoLayout.videoactive(sel, self.resourceJid);
9544
-                sel[0].onplaying = null;
9545
-                if (RTCBrowserType.isTemasysPluginUsed()) {
9546
-                    // 'currentTime' is used to check if the video has started
9547
-                    // and the value is not set by the plugin, so we do it
9548
-                    sel[0].currentTime = 1;
9549
-                }
9550
-            };
9551
-            sel[0].onplaying = onPlayingHandler;
9552
-        }
9560
+    if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
9561
+        waitForPlayback(stream);
9553 9562
 
9554 9563
         APP.RTC.attachMediaStream(sel, stream);
9555 9564
     }
9556 9565
 
9557
-    var self = this;
9558 9566
     stream.onended = function () {
9559 9567
         console.log('stream ended', this);
9560 9568
 
@@ -10595,7 +10603,7 @@ var VideoLayout = (function (my) {
10595 10603
         }
10596 10604
 
10597 10605
         var resource = Strophe.getResourceFromJid(jid);
10598
-        var videoSel = VideoLayout.getVideoSelector(resource);
10606
+        var videoSel = VideoLayout.getPeerVideoSel(resource);
10599 10607
         if (videoSel.length > 0) {
10600 10608
             var videoThumb = videoSel[0];
10601 10609
             // It is not always the case that a videoThumb exists (if there is
@@ -10833,7 +10841,7 @@ var VideoLayout = (function (my) {
10833 10841
 
10834 10842
                         updateLargeVideo = false;
10835 10843
                     }
10836
-                    remoteVideos[resourceJid].waitForRemoteVideo(sel, mediaStream.ssrc, mediaStream.stream);
10844
+                    remoteVideos[resourceJid].waitForPlayback(mediaStream.stream);
10837 10845
                 }
10838 10846
             });
10839 10847
         }
@@ -14370,15 +14378,6 @@ JingleSession.prototype._modifySources = function (successCallback, queueCallbac
14370 14378
     });
14371 14379
     this.removessrc = [];
14372 14380
 
14373
-    // FIXME:
14374
-    // this was a hack for the situation when only one peer exists
14375
-    // in the conference.
14376
-    // check if still required and remove
14377
-    if (sdp.media[0])
14378
-        sdp.media[0] = sdp.media[0].replace('a=recvonly', 'a=sendrecv');
14379
-    if (sdp.media[1])
14380
-        sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');
14381
-
14382 14381
     sdp.raw = sdp.session + sdp.media.join('');
14383 14382
     this.peerconnection.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
14384 14383
         function() {

+ 33
- 25
modules/UI/videolayout/RemoteVideo.js 查看文件

@@ -165,6 +165,37 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
165 165
         this.VideoLayout.updateRemovedVideo(this.resourceJid);
166 166
 };
167 167
 
168
+RemoteVideo.prototype.waitForPlayback = function (stream) {
169
+
170
+    var isVideo = stream.getVideoTracks().length > 0;
171
+    if (!isVideo || stream.id === 'mixedmslabel') {
172
+        return;
173
+    }
174
+
175
+    var self = this;
176
+    var sel = this.VideoLayout.getPeerVideoSel(this.resourceJid);
177
+
178
+    // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
179
+    // when video playback starts
180
+    var onPlayingHandler = function () {
181
+        // FIXME: why do i have to do this for FF?
182
+        if (RTCBrowserType.isFirefox()) {
183
+            APP.RTC.attachMediaStream(sel, stream);
184
+        }
185
+        if (RTCBrowserType.isTemasysPluginUsed()) {
186
+            sel = $('#' + newElementId);
187
+        }
188
+        self.VideoLayout.videoactive(sel, self.resourceJid);
189
+        sel[0].onplaying = null;
190
+        if (RTCBrowserType.isTemasysPluginUsed()) {
191
+            // 'currentTime' is used to check if the video has started
192
+            // and the value is not set by the plugin, so we do it
193
+            sel[0].currentTime = 1;
194
+        }
195
+    };
196
+    sel[0].onplaying = onPlayingHandler;
197
+};
198
+
168 199
 RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
169 200
     if (!this.container)
170 201
         return;
@@ -180,35 +211,12 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
180 211
     sel.hide();
181 212
 
182 213
     // If the container is currently visible we attach the stream.
183
-    if (!isVideo
184
-        || (this.container.offsetParent !== null && isVideo)) {
185
-
186
-        // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
187
-        // when video playback starts
188
-        if (isVideo && stream.id !== 'mixedmslabel') {
189
-            var onPlayingHandler = function () {
190
-                // FIXME: why do i have to do this for FF?
191
-                if (RTCBrowserType.isFirefox()) {
192
-                    APP.RTC.attachMediaStream(sel, stream);
193
-                }
194
-                if (RTCBrowserType.isTemasysPluginUsed()) {
195
-                    sel = $('#' + newElementId);
196
-                }
197
-                self.VideoLayout.videoactive(sel, self.resourceJid);
198
-                sel[0].onplaying = null;
199
-                if (RTCBrowserType.isTemasysPluginUsed()) {
200
-                    // 'currentTime' is used to check if the video has started
201
-                    // and the value is not set by the plugin, so we do it
202
-                    sel[0].currentTime = 1;
203
-                }
204
-            };
205
-            sel[0].onplaying = onPlayingHandler;
206
-        }
214
+    if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
215
+        waitForPlayback(stream);
207 216
 
208 217
         APP.RTC.attachMediaStream(sel, stream);
209 218
     }
210 219
 
211
-    var self = this;
212 220
     stream.onended = function () {
213 221
         console.log('stream ended', this);
214 222
 

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

@@ -475,7 +475,7 @@ var VideoLayout = (function (my) {
475 475
         }
476 476
 
477 477
         var resource = Strophe.getResourceFromJid(jid);
478
-        var videoSel = VideoLayout.getVideoSelector(resource);
478
+        var videoSel = VideoLayout.getPeerVideoSel(resource);
479 479
         if (videoSel.length > 0) {
480 480
             var videoThumb = videoSel[0];
481 481
             // It is not always the case that a videoThumb exists (if there is
@@ -713,7 +713,7 @@ var VideoLayout = (function (my) {
713 713
 
714 714
                         updateLargeVideo = false;
715 715
                     }
716
-                    remoteVideos[resourceJid].waitForRemoteVideo(sel, mediaStream.ssrc, mediaStream.stream);
716
+                    remoteVideos[resourceJid].waitForPlayback(mediaStream.stream);
717 717
                 }
718 718
             });
719 719
         }

Loading…
取消
儲存