|
|
@@ -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
|
/**
|