|
|
@@ -1,12 +1,14 @@
|
|
1
|
1
|
/* global APP, $, interfaceConfig */
|
|
2
|
2
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
|
3
|
3
|
|
|
4
|
|
-import { VIDEO_TYPE } from '../../../react/features/base/media';
|
|
|
4
|
+import { MEDIA_TYPE, VIDEO_TYPE } from '../../../react/features/base/media';
|
|
5
|
5
|
import {
|
|
6
|
6
|
getLocalParticipant as getLocalParticipantFromStore,
|
|
7
|
7
|
getPinnedParticipant,
|
|
|
8
|
+ getParticipantById,
|
|
8
|
9
|
pinParticipant
|
|
9
|
10
|
} from '../../../react/features/base/participants';
|
|
|
11
|
+import { getTrackByMediaTypeAndParticipant } from '../../../react/features/base/tracks';
|
|
10
|
12
|
import { SHARED_VIDEO_CONTAINER_TYPE } from '../shared_video/SharedVideo';
|
|
11
|
13
|
import SharedVideoThumb from '../shared_video/SharedVideoThumb';
|
|
12
|
14
|
|
|
|
@@ -73,9 +75,6 @@ const VideoLayout = {
|
|
73
|
75
|
emitter,
|
|
74
|
76
|
this._updateLargeVideoIfDisplayed.bind(this));
|
|
75
|
77
|
|
|
76
|
|
- // sets default video type of local video
|
|
77
|
|
- // FIXME container type is totally different thing from the video type
|
|
78
|
|
- localVideoThumbnail.setVideoType(VIDEO_CONTAINER_TYPE);
|
|
79
|
78
|
this.registerListeners();
|
|
80
|
79
|
},
|
|
81
|
80
|
|
|
|
@@ -221,10 +220,16 @@ const VideoLayout = {
|
|
221
|
220
|
* @returns {String} the video type video or screen.
|
|
222
|
221
|
*/
|
|
223
|
222
|
getRemoteVideoType(id) {
|
|
224
|
|
- const smallVideo = VideoLayout.getSmallVideo(id);
|
|
|
223
|
+ const state = APP.store.getState();
|
|
|
224
|
+ const participant = getParticipantById(state, id);
|
|
|
225
|
+
|
|
|
226
|
+ if (participant?.isFakeParticipant) {
|
|
|
227
|
+ return SHARED_VIDEO_CONTAINER_TYPE;
|
|
|
228
|
+ }
|
|
225
|
229
|
|
|
|
230
|
+ const videoTrack = getTrackByMediaTypeAndParticipant(state['features/base/tracks'], MEDIA_TYPE.VIDEO, id);
|
|
226
|
231
|
|
|
227
|
|
- return smallVideo ? smallVideo.getVideoType() : null;
|
|
|
232
|
+ return videoTrack?.videoType;
|
|
228
|
233
|
},
|
|
229
|
234
|
|
|
230
|
235
|
isPinned(id) {
|
|
|
@@ -308,12 +313,6 @@ const VideoLayout = {
|
|
308
|
313
|
addRemoteVideoContainer(id, remoteVideo) {
|
|
309
|
314
|
remoteVideos[id] = remoteVideo;
|
|
310
|
315
|
|
|
311
|
|
- if (!remoteVideo.getVideoType()) {
|
|
312
|
|
- // make video type the default one (camera)
|
|
313
|
|
- // FIXME container type is not a video type
|
|
314
|
|
- remoteVideo.setVideoType(VIDEO_CONTAINER_TYPE);
|
|
315
|
|
- }
|
|
316
|
|
-
|
|
317
|
316
|
// Initialize the view
|
|
318
|
317
|
remoteVideo.updateView();
|
|
319
|
318
|
},
|
|
|
@@ -491,22 +490,6 @@ const VideoLayout = {
|
|
491
|
490
|
|
|
492
|
491
|
logger.info('Peer video type changed: ', id, newVideoType);
|
|
493
|
492
|
|
|
494
|
|
- let smallVideo;
|
|
495
|
|
-
|
|
496
|
|
- if (APP.conference.isLocalId(id)) {
|
|
497
|
|
- if (!localVideoThumbnail) {
|
|
498
|
|
- logger.warn('Local video not ready yet');
|
|
499
|
|
-
|
|
500
|
|
- return;
|
|
501
|
|
- }
|
|
502
|
|
- smallVideo = localVideoThumbnail;
|
|
503
|
|
- } else if (remoteVideos[id]) {
|
|
504
|
|
- smallVideo = remoteVideos[id];
|
|
505
|
|
- } else {
|
|
506
|
|
- return;
|
|
507
|
|
- }
|
|
508
|
|
- smallVideo.setVideoType(newVideoType);
|
|
509
|
|
-
|
|
510
|
493
|
this._updateLargeVideoIfDisplayed(id, true);
|
|
511
|
494
|
},
|
|
512
|
495
|
|
|
|
@@ -584,17 +567,16 @@ const VideoLayout = {
|
|
584
|
567
|
}
|
|
585
|
568
|
const currentContainer = largeVideo.getCurrentContainer();
|
|
586
|
569
|
const currentContainerType = largeVideo.getCurrentContainerType();
|
|
587
|
|
- const currentId = largeVideo.id;
|
|
588
|
570
|
const isOnLarge = this.isCurrentlyOnLarge(id);
|
|
589
|
|
- const smallVideo = this.getSmallVideo(id);
|
|
|
571
|
+ const state = APP.store.getState();
|
|
|
572
|
+ const videoTrack = getTrackByMediaTypeAndParticipant(state['features/base/tracks'], MEDIA_TYPE.VIDEO, id);
|
|
|
573
|
+ const videoStream = videoTrack?.jitsiTrack;
|
|
590
|
574
|
|
|
591
|
575
|
if (isOnLarge && !forceUpdate
|
|
592
|
576
|
&& LargeVideoManager.isVideoContainer(currentContainerType)
|
|
593
|
|
- && smallVideo) {
|
|
|
577
|
+ && videoStream) {
|
|
594
|
578
|
const currentStreamId = currentContainer.getStreamID();
|
|
595
|
|
- const newStreamId
|
|
596
|
|
- = smallVideo.videoStream
|
|
597
|
|
- ? smallVideo.videoStream.getId() : null;
|
|
|
579
|
+ const newStreamId = videoStream?.getId() || null;
|
|
598
|
580
|
|
|
599
|
581
|
// FIXME it might be possible to get rid of 'forceUpdate' argument
|
|
600
|
582
|
if (currentStreamId !== newStreamId) {
|
|
|
@@ -603,42 +585,17 @@ const VideoLayout = {
|
|
603
|
585
|
}
|
|
604
|
586
|
}
|
|
605
|
587
|
|
|
606
|
|
- if ((!isOnLarge || forceUpdate) && smallVideo) {
|
|
|
588
|
+ if (!isOnLarge || forceUpdate) {
|
|
607
|
589
|
const videoType = this.getRemoteVideoType(id);
|
|
608
|
590
|
|
|
609
|
|
- // FIXME video type is not the same thing as container type
|
|
610
|
|
-
|
|
611
|
|
- if (id !== currentId && videoType === VIDEO_CONTAINER_TYPE) {
|
|
612
|
|
- APP.API.notifyOnStageParticipantChanged(id);
|
|
613
|
|
- }
|
|
614
|
|
-
|
|
615
|
|
- let oldSmallVideo;
|
|
616
|
|
-
|
|
617
|
|
- if (currentId) {
|
|
618
|
|
- oldSmallVideo = this.getSmallVideo(currentId);
|
|
619
|
|
- }
|
|
620
|
|
-
|
|
621
|
|
- smallVideo.waitForResolutionChange();
|
|
622
|
|
- if (oldSmallVideo) {
|
|
623
|
|
- oldSmallVideo.waitForResolutionChange();
|
|
624
|
|
- }
|
|
625
|
591
|
|
|
626
|
592
|
largeVideo.updateLargeVideo(
|
|
627
|
593
|
id,
|
|
628
|
|
- smallVideo.videoStream,
|
|
|
594
|
+ videoStream,
|
|
629
|
595
|
videoType || VIDEO_TYPE.CAMERA
|
|
630
|
|
- ).then(() => {
|
|
631
|
|
- // update current small video and the old one
|
|
632
|
|
- smallVideo.updateView();
|
|
633
|
|
- oldSmallVideo && oldSmallVideo.updateView();
|
|
634
|
|
- }, () => {
|
|
635
|
|
- // use clicked other video during update, nothing to do.
|
|
|
596
|
+ ).catch(() => {
|
|
|
597
|
+ // do nothing
|
|
636
|
598
|
});
|
|
637
|
|
-
|
|
638
|
|
- } else if (currentId) {
|
|
639
|
|
- const currentSmallVideo = this.getSmallVideo(currentId);
|
|
640
|
|
-
|
|
641
|
|
- currentSmallVideo && currentSmallVideo.updateView();
|
|
642
|
599
|
}
|
|
643
|
600
|
},
|
|
644
|
601
|
|
|
|
@@ -723,10 +680,6 @@ const VideoLayout = {
|
|
723
|
680
|
this.localFlipX = val;
|
|
724
|
681
|
},
|
|
725
|
682
|
|
|
726
|
|
- getEventEmitter() {
|
|
727
|
|
- return eventEmitter;
|
|
728
|
|
- },
|
|
729
|
|
-
|
|
730
|
683
|
/**
|
|
731
|
684
|
* Handles user's features changes.
|
|
732
|
685
|
*/
|