Преглед изворни кода

Adopts to new semantics of JitsiTrack#attach method.

j8
paweldomas пре 10 година
родитељ
комит
48cedb0865

+ 1
- 1
modules/UI/videolayout/LargeVideo.js Прегледај датотеку

@@ -280,7 +280,7 @@ class VideoContainer extends LargeContainer {
280 280
         if(!stream)
281 281
             return;
282 282
 
283
-        stream.attach(this.$video);
283
+        stream.attach(this.$video[0]);
284 284
 
285 285
         let flipX = stream.isLocal() && !this.isScreenSharing();
286 286
         this.$video.css({

+ 2
- 5
modules/UI/videolayout/LocalVideo.js Прегледај датотеку

@@ -175,8 +175,6 @@ LocalVideo.prototype.changeVideo = function (stream) {
175 175
     // Put the new video always in front
176 176
     UIUtil.prependChild(localVideoContainer, localVideo);
177 177
 
178
-    var localVideoSelector = $('#' + localVideo.id);
179
-
180 178
     // Add click handler to both video and video wrapper elements in case
181 179
     // there's no video.
182 180
 
@@ -184,14 +182,13 @@ LocalVideo.prototype.changeVideo = function (stream) {
184 182
     localVideo.onclick = localVideoClick;
185 183
 
186 184
     if (this.flipX) {
187
-        localVideoSelector.addClass("flipVideoX");
185
+        $(localVideo).addClass("flipVideoX");
188 186
     }
189 187
 
190 188
     // Attach WebRTC stream
191
-    stream.attach(localVideoSelector);
189
+    localVideo = stream.attach(localVideo);
192 190
 
193 191
     let endedHandler = () => {
194
-        localVideo = $('#' + localVideo.id)[0];
195 192
         localVideoContainer.removeChild(localVideo);
196 193
         this.VideoLayout.updateRemovedVideo(this.id);
197 194
         stream.off(TrackEvents.TRACK_STOPPED, endedHandler);

+ 13
- 21
modules/UI/videolayout/RemoteVideo.js Прегледај датотеку

@@ -181,7 +181,7 @@ RemoteVideo.prototype.remove = function () {
181 181
     }
182 182
 };
183 183
 
184
-RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
184
+RemoteVideo.prototype.waitForPlayback = function (streamElement, stream) {
185 185
 
186 186
     var webRtcStream = stream.getOriginalStream();
187 187
     var isVideo = stream.isVideoTrack();
@@ -199,18 +199,15 @@ RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
199 199
             //FIXME: weshould use the lib here
200 200
             //APP.RTC.attachMediaStream(sel, webRtcStream);
201 201
         }
202
-        if (RTCBrowserType.isTemasysPluginUsed()) {
203
-            sel = self.selectVideoElement();
204
-        }
205
-        self.VideoLayout.videoactive(sel, self.id);
206
-        sel[0].onplaying = null;
202
+        self.VideoLayout.videoactive(streamElement, self.id);
203
+        streamElement.onplaying = null;
207 204
         if (RTCBrowserType.isTemasysPluginUsed()) {
208 205
             // 'currentTime' is used to check if the video has started
209 206
             // and the value is not set by the plugin, so we do it
210
-            sel[0].currentTime = 1;
207
+            streamElement.currentTime = 1;
211 208
         }
212 209
     };
213
-    sel[0].onplaying = onPlayingHandler;
210
+    streamElement.onplaying = onPlayingHandler;
214 211
 };
215 212
 
216 213
 RemoteVideo.prototype.addRemoteStreamElement = function (stream) {
@@ -250,25 +247,20 @@ RemoteVideo.prototype.addRemoteStreamElement = function (stream) {
250 247
     // Put new stream element always in front
251 248
     UIUtils.prependChild(this.container, streamElement);
252 249
 
253
-    let sel = $(`#${newElementId}`);
250
+    // If we hide element when Temasys plugin is used then
251
+    // we'll never receive 'onplay' event and other logic won't work as expected
252
+    if (!RTCBrowserType.isTemasysPluginUsed()) {
253
+        $(streamElement).hide();
254
+    }
254 255
 
255 256
     // If the container is currently visible we attach the stream to the element.
256 257
     if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
257
-        this.waitForPlayback(sel, stream);
258
+        this.waitForPlayback(streamElement, stream);
258 259
 
259
-        stream.attach(sel);
260
+        streamElement = stream.attach(streamElement);
260 261
     }
261 262
 
262
-    // hide element only after stream was (maybe) attached
263
-    // because Temasys plugin requires video element
264
-    // to be visible to attach the stream
265
-    sel.hide();
266
-
267
-    // reselect
268
-    if (RTCBrowserType.isTemasysPluginUsed()) {
269
-        sel = $(`#${newElementId}`);
270
-    }
271
-    sel.click(onClickHandler);
263
+    $(streamElement).click(onClickHandler);
272 264
 },
273 265
 
274 266
 /**

+ 4
- 4
modules/UI/videolayout/VideoLayout.js Прегледај датотеку

@@ -126,7 +126,7 @@ var VideoLayout = {
126 126
 
127 127
     changeLocalAudio (stream) {
128 128
         let localAudio = document.getElementById('localAudio');
129
-        stream.attach($(localAudio));
129
+        localAudio = stream.attach(localAudio);
130 130
 
131 131
         //return; // FIXME maybe move this into the library?
132 132
         // Writing volume not allowed in IE
@@ -142,7 +142,7 @@ var VideoLayout = {
142 142
             // The issue is not present on Safari. Also if we hide it in Safari
143 143
             // then the local audio track will have 'enabled' flag set to false
144 144
             // which will result in audio mute issues
145
-            $('#localAudio').hide();
145
+            $(localAudio).hide();
146 146
         }
147 147
     },
148 148
 
@@ -369,9 +369,9 @@ var VideoLayout = {
369 369
 
370 370
     videoactive (videoelem, resourceJid) {
371 371
 
372
-        console.info(resourceJid + " video is now active");
372
+        console.info(resourceJid + " video is now active", videoelem);
373 373
 
374
-        videoelem.show();
374
+        $(videoelem).show();
375 375
         VideoLayout.resizeThumbnails();
376 376
 
377 377
         // Update the large video to the last added video only if there's no

Loading…
Откажи
Сачувај