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

Adopts to new semantics of JitsiTrack#attach method.

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

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

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

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

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

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

181
     }
181
     }
182
 };
182
 };
183
 
183
 
184
-RemoteVideo.prototype.waitForPlayback = function (sel, stream) {
184
+RemoteVideo.prototype.waitForPlayback = function (streamElement, stream) {
185
 
185
 
186
     var webRtcStream = stream.getOriginalStream();
186
     var webRtcStream = stream.getOriginalStream();
187
     var isVideo = stream.isVideoTrack();
187
     var isVideo = stream.isVideoTrack();
199
             //FIXME: weshould use the lib here
199
             //FIXME: weshould use the lib here
200
             //APP.RTC.attachMediaStream(sel, webRtcStream);
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
         if (RTCBrowserType.isTemasysPluginUsed()) {
204
         if (RTCBrowserType.isTemasysPluginUsed()) {
208
             // 'currentTime' is used to check if the video has started
205
             // 'currentTime' is used to check if the video has started
209
             // and the value is not set by the plugin, so we do it
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
 RemoteVideo.prototype.addRemoteStreamElement = function (stream) {
213
 RemoteVideo.prototype.addRemoteStreamElement = function (stream) {
250
     // Put new stream element always in front
247
     // Put new stream element always in front
251
     UIUtils.prependChild(this.container, streamElement);
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
     // If the container is currently visible we attach the stream to the element.
256
     // If the container is currently visible we attach the stream to the element.
256
     if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
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
 
126
 
127
     changeLocalAudio (stream) {
127
     changeLocalAudio (stream) {
128
         let localAudio = document.getElementById('localAudio');
128
         let localAudio = document.getElementById('localAudio');
129
-        stream.attach($(localAudio));
129
+        localAudio = stream.attach(localAudio);
130
 
130
 
131
         //return; // FIXME maybe move this into the library?
131
         //return; // FIXME maybe move this into the library?
132
         // Writing volume not allowed in IE
132
         // Writing volume not allowed in IE
142
             // The issue is not present on Safari. Also if we hide it in Safari
142
             // The issue is not present on Safari. Also if we hide it in Safari
143
             // then the local audio track will have 'enabled' flag set to false
143
             // then the local audio track will have 'enabled' flag set to false
144
             // which will result in audio mute issues
144
             // which will result in audio mute issues
145
-            $('#localAudio').hide();
145
+            $(localAudio).hide();
146
         }
146
         }
147
     },
147
     },
148
 
148
 
369
 
369
 
370
     videoactive (videoelem, resourceJid) {
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
         VideoLayout.resizeThumbnails();
375
         VideoLayout.resizeThumbnails();
376
 
376
 
377
         // Update the large video to the last added video only if there's no
377
         // Update the large video to the last added video only if there's no

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