2017-10-10 23:31:40 +00:00
|
|
|
/* global APP, $, interfaceConfig */
|
2017-10-12 23:02:29 +00:00
|
|
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
2015-07-10 09:57:20 +00:00
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
import {
|
|
|
|
getNearestReceiverVideoQualityLevel,
|
|
|
|
setMaxReceiverVideoQuality
|
|
|
|
} from '../../../react/features/base/conference';
|
2017-10-10 23:31:40 +00:00
|
|
|
import {
|
|
|
|
JitsiParticipantConnectionStatus
|
|
|
|
} from '../../../react/features/base/lib-jitsi-meet';
|
2018-07-02 15:39:28 +00:00
|
|
|
import { VIDEO_TYPE } from '../../../react/features/base/media';
|
2017-08-10 20:51:35 +00:00
|
|
|
import {
|
2019-02-07 03:19:02 +00:00
|
|
|
getLocalParticipant as getLocalParticipantFromStore,
|
2017-08-10 20:51:35 +00:00
|
|
|
getPinnedParticipant,
|
|
|
|
pinParticipant
|
|
|
|
} from '../../../react/features/base/participants';
|
2018-08-08 18:48:23 +00:00
|
|
|
import {
|
|
|
|
shouldDisplayTileView
|
|
|
|
} from '../../../react/features/video-layout';
|
2018-05-22 17:13:51 +00:00
|
|
|
import { SHARED_VIDEO_CONTAINER_TYPE } from '../shared_video/SharedVideo';
|
|
|
|
import SharedVideoThumb from '../shared_video/SharedVideoThumb';
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
import Filmstrip from './Filmstrip';
|
|
|
|
import UIEvents from '../../../service/UI/UIEvents';
|
|
|
|
import UIUtil from '../util/UIUtil';
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
import RemoteVideo from './RemoteVideo';
|
|
|
|
import LargeVideoManager from './LargeVideoManager';
|
|
|
|
import { VIDEO_CONTAINER_TYPE } from './VideoContainer';
|
2018-05-22 17:13:51 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
import LocalVideo from './LocalVideo';
|
2015-12-14 12:26:50 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteVideos = {};
|
|
|
|
let localVideoThumbnail = null;
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
let eventEmitter = null;
|
|
|
|
|
|
|
|
let largeVideo;
|
2015-01-27 12:03:26 +00:00
|
|
|
|
2016-05-07 01:50:37 +00:00
|
|
|
/**
|
|
|
|
* flipX state of the localVideo
|
|
|
|
*/
|
|
|
|
let localFlipX = null;
|
|
|
|
|
2017-02-15 21:39:16 +00:00
|
|
|
/**
|
|
|
|
* Handler for local flip X changed event.
|
|
|
|
* @param {Object} val
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
function onLocalFlipXChanged(val) {
|
2017-02-15 21:39:16 +00:00
|
|
|
localFlipX = val;
|
2017-10-12 23:02:29 +00:00
|
|
|
if (largeVideo) {
|
2017-02-15 21:39:16 +00:00
|
|
|
largeVideo.onLocalFlipXChange(val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-18 19:59:07 +00:00
|
|
|
/**
|
|
|
|
* Returns the redux representation of all known users.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {Array}
|
|
|
|
*/
|
|
|
|
function getAllParticipants() {
|
|
|
|
return APP.store.getState()['features/base/participants'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array of all thumbnails in the filmstrip.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {Array}
|
|
|
|
*/
|
|
|
|
function getAllThumbnails() {
|
|
|
|
return [
|
|
|
|
localVideoThumbnail,
|
|
|
|
...Object.values(remoteVideos)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-02-07 03:19:02 +00:00
|
|
|
/**
|
|
|
|
* Private helper to get the redux representation of the local participant.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
function getLocalParticipant() {
|
|
|
|
return getLocalParticipantFromStore(APP.store.getState());
|
|
|
|
}
|
|
|
|
|
2018-05-18 00:41:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the user ID of the remote participant that is current the dominant
|
|
|
|
* speaker.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {string|null}
|
|
|
|
*/
|
|
|
|
function getCurrentRemoteDominantSpeakerID() {
|
2018-05-18 19:59:07 +00:00
|
|
|
const dominantSpeaker = getAllParticipants()
|
2018-05-18 00:41:28 +00:00
|
|
|
.find(participant => participant.dominantSpeaker);
|
|
|
|
|
|
|
|
if (dominantSpeaker) {
|
|
|
|
return dominantSpeaker.local ? null : dominantSpeaker.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
/**
|
|
|
|
* Returns the corresponding resource id to the given peer container
|
|
|
|
* DOM element.
|
|
|
|
*
|
|
|
|
* @return the corresponding resource id to the given peer container
|
|
|
|
* DOM element
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
function getPeerContainerResourceId(containerElement) {
|
2015-12-14 14:51:02 +00:00
|
|
|
if (localVideoThumbnail.container === containerElement) {
|
|
|
|
return localVideoThumbnail.id;
|
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const i = containerElement.id.indexOf('participant_');
|
2015-12-14 14:51:02 +00:00
|
|
|
|
|
|
|
if (i >= 0) {
|
|
|
|
return containerElement.id.substring(i + 12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const VideoLayout = {
|
|
|
|
init(emitter) {
|
2015-01-27 12:03:26 +00:00
|
|
|
eventEmitter = emitter;
|
2017-02-15 21:39:16 +00:00
|
|
|
|
2018-05-21 22:10:43 +00:00
|
|
|
localVideoThumbnail = new LocalVideo(
|
|
|
|
VideoLayout,
|
|
|
|
emitter,
|
|
|
|
this._updateLargeVideoIfDisplayed.bind(this));
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-03-22 18:27:11 +00:00
|
|
|
// sets default video type of local video
|
2016-09-21 20:02:19 +00:00
|
|
|
// FIXME container type is totally different thing from the video type
|
2016-03-22 18:27:11 +00:00
|
|
|
localVideoThumbnail.setVideoType(VIDEO_CONTAINER_TYPE);
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-03-22 18:27:11 +00:00
|
|
|
// if we do not resize the thumbs here, if there is no video device
|
|
|
|
// the local video thumb maybe one pixel
|
2018-04-10 20:03:44 +00:00
|
|
|
this.resizeThumbnails(true);
|
2015-07-29 19:39:09 +00:00
|
|
|
|
2017-02-15 21:39:16 +00:00
|
|
|
this.registerListeners();
|
|
|
|
},
|
|
|
|
|
2017-05-11 00:19:35 +00:00
|
|
|
/**
|
2019-01-01 21:19:34 +00:00
|
|
|
* Registering listeners for UI events in Video layout component.
|
2017-05-11 00:19:35 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2019-01-01 21:19:34 +00:00
|
|
|
registerListeners() {
|
|
|
|
eventEmitter.addListener(UIEvents.LOCAL_FLIPX_CHANGED,
|
|
|
|
onLocalFlipXChanged);
|
2017-05-11 00:19:35 +00:00
|
|
|
},
|
|
|
|
|
2017-02-15 21:39:16 +00:00
|
|
|
/**
|
2019-01-01 21:19:34 +00:00
|
|
|
* Cleans up state of this singleton {@code VideoLayout}.
|
2017-02-15 21:39:16 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2019-01-01 21:19:34 +00:00
|
|
|
reset() {
|
|
|
|
this._resetLargeVideo();
|
|
|
|
this._resetFilmstrip();
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-01-19 09:20:00 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
initLargeVideo() {
|
2019-01-01 21:19:34 +00:00
|
|
|
this._resetLargeVideo();
|
2017-05-11 00:19:35 +00:00
|
|
|
|
2016-09-14 21:26:17 +00:00
|
|
|
largeVideo = new LargeVideoManager(eventEmitter);
|
2017-10-12 23:02:29 +00:00
|
|
|
if (localFlipX) {
|
2016-05-07 01:50:37 +00:00
|
|
|
largeVideo.onLocalFlipXChange(localFlipX);
|
|
|
|
}
|
2016-09-08 18:16:23 +00:00
|
|
|
largeVideo.updateContainerSize();
|
2015-12-25 16:55:45 +00:00
|
|
|
},
|
|
|
|
|
2016-09-28 21:31:40 +00:00
|
|
|
/**
|
|
|
|
* Sets the audio level of the video elements associated to the given id.
|
|
|
|
*
|
|
|
|
* @param id the video identifier in the form it comes from the library
|
|
|
|
* @param lvl the new audio level to update to
|
|
|
|
*/
|
2015-12-25 16:55:45 +00:00
|
|
|
setAudioLevel(id, lvl) {
|
2017-10-12 23:02:29 +00:00
|
|
|
const smallVideo = this.getSmallVideo(id);
|
|
|
|
|
|
|
|
if (smallVideo) {
|
2016-09-28 21:31:40 +00:00
|
|
|
smallVideo.updateAudioLevelIndicator(lvl);
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-09-28 21:31:40 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
if (largeVideo && id === largeVideo.id) {
|
2016-09-28 21:31:40 +00:00
|
|
|
largeVideo.updateLargeVideoAudioLevel(lvl);
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2015-12-25 16:55:45 +00:00
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
changeLocalVideo(stream) {
|
2019-02-07 03:19:02 +00:00
|
|
|
const localId = getLocalParticipant().id;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2015-12-30 12:14:56 +00:00
|
|
|
this.onVideoTypeChanged(localId, stream.videoType);
|
2015-08-05 12:09:12 +00:00
|
|
|
|
2017-04-27 22:30:39 +00:00
|
|
|
localVideoThumbnail.changeVideo(stream);
|
2015-01-19 09:20:00 +00:00
|
|
|
|
2018-05-21 22:10:43 +00:00
|
|
|
this._updateLargeVideoIfDisplayed(localId);
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
2016-01-11 23:14:56 +00:00
|
|
|
/**
|
|
|
|
* Get's the localID of the conference and set it to the local video
|
|
|
|
* (small one). This needs to be called as early as possible, when muc is
|
|
|
|
* actually joined. Otherwise events can come with information like email
|
|
|
|
* and setting them assume the id is already set.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
mucJoined() {
|
2015-12-25 16:55:45 +00:00
|
|
|
if (largeVideo && !largeVideo.id) {
|
2019-02-07 03:19:02 +00:00
|
|
|
this.updateLargeVideo(getLocalParticipant().id, true);
|
2015-12-14 12:26:50 +00:00
|
|
|
}
|
2017-07-05 18:17:30 +00:00
|
|
|
|
|
|
|
// FIXME: replace this call with a generic update call once SmallVideo
|
|
|
|
// only contains a ReactElement. Then remove this call once the
|
|
|
|
// Filmstrip is fully in React.
|
|
|
|
localVideoThumbnail.updateIndicators();
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-04-22 09:31:08 +00:00
|
|
|
|
2015-03-27 09:36:39 +00:00
|
|
|
/**
|
|
|
|
* Adds or removes icons for not available camera and microphone.
|
|
|
|
* @param resourceJid the jid of user
|
|
|
|
* @param devices available devices
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
setDeviceAvailabilityIcons(id, devices) {
|
2016-01-25 22:39:05 +00:00
|
|
|
if (APP.conference.isLocalId(id)) {
|
|
|
|
localVideoThumbnail.setDeviceAvailabilityIcons(devices);
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2015-03-27 09:36:39 +00:00
|
|
|
return;
|
2016-01-25 22:39:05 +00:00
|
|
|
}
|
2015-03-27 09:36:39 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const video = remoteVideos[id];
|
|
|
|
|
2016-01-25 22:39:05 +00:00
|
|
|
if (!video) {
|
|
|
|
return;
|
2015-03-27 09:36:39 +00:00
|
|
|
}
|
2016-01-25 22:39:05 +00:00
|
|
|
|
|
|
|
video.setDeviceAvailabilityIcons(devices);
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-03-27 09:36:39 +00:00
|
|
|
|
2016-05-01 18:35:18 +00:00
|
|
|
/**
|
|
|
|
* Shows/hides local video.
|
|
|
|
* @param {boolean} true to make the local video visible, false - otherwise
|
|
|
|
*/
|
|
|
|
setLocalVideoVisible(visible) {
|
|
|
|
localVideoThumbnail.setVisible(visible);
|
|
|
|
},
|
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
/**
|
2014-06-19 13:40:54 +00:00
|
|
|
* Checks if removed video is currently displayed and tries to display
|
|
|
|
* another one instead.
|
2016-03-23 22:45:27 +00:00
|
|
|
* Uses focusedID if any or dominantSpeakerID if any,
|
|
|
|
* otherwise elects new video, in this order.
|
2014-06-12 18:33:57 +00:00
|
|
|
*/
|
2018-05-21 21:22:41 +00:00
|
|
|
_updateAfterThumbRemoved(id) {
|
2017-06-05 23:47:26 +00:00
|
|
|
// Always trigger an update if large video is empty.
|
|
|
|
if (!largeVideo
|
|
|
|
|| (this.getLargeVideoID() && !this.isCurrentlyOnLarge(id))) {
|
2015-12-14 14:51:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-10 20:51:35 +00:00
|
|
|
const pinnedId = this.getPinnedId();
|
2015-12-14 12:26:50 +00:00
|
|
|
let newId;
|
2015-07-10 09:57:20 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
if (pinnedId) {
|
2016-03-23 22:45:27 +00:00
|
|
|
newId = pinnedId;
|
2018-05-18 00:41:28 +00:00
|
|
|
} else if (getCurrentRemoteDominantSpeakerID()) {
|
|
|
|
newId = getCurrentRemoteDominantSpeakerID();
|
2017-10-12 23:02:29 +00:00
|
|
|
} else { // Otherwise select last visible video
|
2015-12-14 14:51:02 +00:00
|
|
|
newId = this.electLastVisibleVideo();
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2015-12-14 14:51:02 +00:00
|
|
|
|
2015-12-25 16:55:45 +00:00
|
|
|
this.updateLargeVideo(newId);
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-04-22 09:31:08 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
electLastVisibleVideo() {
|
2015-07-20 17:32:04 +00:00
|
|
|
// pick the last visible video in the row
|
|
|
|
// if nobody else is left, this picks the local video
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteThumbs = Filmstrip.getThumbs(true).remoteThumbs;
|
2016-09-15 02:20:54 +00:00
|
|
|
let thumbs = remoteThumbs.filter('[id!="mixedstream"]');
|
2015-12-30 10:55:51 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const lastVisible = thumbs.filter(':visible:last');
|
|
|
|
|
2015-12-30 10:55:51 +00:00
|
|
|
if (lastVisible.length) {
|
2017-10-12 23:02:29 +00:00
|
|
|
const id = getPeerContainerResourceId(lastVisible[0]);
|
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
if (remoteVideos[id]) {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info(`electLastVisibleVideo: ${id}`);
|
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
return id;
|
2015-10-01 22:46:42 +00:00
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
// The RemoteVideo was removed (but the DOM elements may still
|
|
|
|
// exist).
|
2015-10-01 22:46:42 +00:00
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info('Last visible video no longer exists');
|
2017-04-10 17:59:44 +00:00
|
|
|
thumbs = Filmstrip.getThumbs().remoteThumbs;
|
2015-12-30 10:55:51 +00:00
|
|
|
if (thumbs.length) {
|
2017-10-12 23:02:29 +00:00
|
|
|
const id = getPeerContainerResourceId(thumbs[0]);
|
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
if (remoteVideos[id]) {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info(`electLastVisibleVideo: ${id}`);
|
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
return id;
|
2015-04-22 09:31:08 +00:00
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
// The RemoteVideo was removed (but the DOM elements may
|
|
|
|
// still exist).
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2015-10-01 22:46:42 +00:00
|
|
|
|
2015-12-14 14:51:02 +00:00
|
|
|
// Go with local video
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info('Fallback to local video...');
|
|
|
|
|
2019-02-07 03:19:02 +00:00
|
|
|
const { id } = getLocalParticipant();
|
2015-10-01 22:46:42 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info(`electLastVisibleVideo: ${id}`);
|
2015-12-14 14:51:02 +00:00
|
|
|
|
|
|
|
return id;
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-11-30 11:54:54 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
onRemoteStreamAdded(stream) {
|
|
|
|
const id = stream.getParticipantId();
|
|
|
|
const remoteVideo = remoteVideos[id];
|
2016-04-26 21:38:07 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
if (!remoteVideo) {
|
2016-04-26 21:38:07 +00:00
|
|
|
return;
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-04-26 21:38:07 +00:00
|
|
|
|
|
|
|
remoteVideo.addRemoteStreamElement(stream);
|
2016-01-14 16:28:24 +00:00
|
|
|
|
2017-07-19 10:08:51 +00:00
|
|
|
// Make sure track's muted state is reflected
|
2017-10-12 23:02:29 +00:00
|
|
|
if (stream.getType() === 'audio') {
|
2017-07-19 10:08:51 +00:00
|
|
|
this.onAudioMute(stream.getParticipantId(), stream.isMuted());
|
|
|
|
} else {
|
|
|
|
this.onVideoMute(stream.getParticipantId(), stream.isMuted());
|
2016-01-14 16:28:24 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2016-02-23 22:47:55 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
onRemoteStreamRemoved(stream) {
|
|
|
|
const id = stream.getParticipantId();
|
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
2016-10-03 16:12:04 +00:00
|
|
|
// Remote stream may be removed after participant left the conference.
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-10-03 16:12:04 +00:00
|
|
|
if (remoteVideo) {
|
2016-02-26 13:20:36 +00:00
|
|
|
remoteVideo.removeRemoteStreamElement(stream);
|
|
|
|
}
|
2018-05-21 21:54:16 +00:00
|
|
|
|
2018-05-21 22:10:43 +00:00
|
|
|
if (stream.isVideoTrack()) {
|
|
|
|
this._updateLargeVideoIfDisplayed(id);
|
2018-05-21 21:54:16 +00:00
|
|
|
}
|
|
|
|
|
2017-07-19 10:08:51 +00:00
|
|
|
this.updateMutedForNoTracks(id, stream.getType());
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* FIXME get rid of this method once muted indicator are reactified (by
|
|
|
|
* making sure that user with no tracks is displayed as muted )
|
|
|
|
*
|
|
|
|
* If participant has no tracks will make the UI display muted status.
|
|
|
|
* @param {string} participantId
|
|
|
|
* @param {string} mediaType 'audio' or 'video'
|
|
|
|
*/
|
|
|
|
updateMutedForNoTracks(participantId, mediaType) {
|
|
|
|
const participant = APP.conference.getParticipantById(participantId);
|
|
|
|
|
|
|
|
if (participant
|
|
|
|
&& !participant.getTracksByMediaType(mediaType).length) {
|
|
|
|
if (mediaType === 'audio') {
|
|
|
|
APP.UI.setAudioMuted(participantId, true);
|
|
|
|
} else if (mediaType === 'video') {
|
|
|
|
APP.UI.setVideoMuted(participantId, true);
|
|
|
|
} else {
|
|
|
|
logger.error(`Unsupported media type: ${mediaType}`);
|
|
|
|
}
|
|
|
|
}
|
2016-02-23 22:47:55 +00:00
|
|
|
},
|
2014-11-21 13:29:05 +00:00
|
|
|
|
2015-11-16 23:42:21 +00:00
|
|
|
/**
|
|
|
|
* Return the type of the remote video.
|
2015-12-14 12:26:50 +00:00
|
|
|
* @param id the id for the remote video
|
2016-03-15 18:36:17 +00:00
|
|
|
* @returns {String} the video type video or screen.
|
2015-11-16 23:42:21 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
getRemoteVideoType(id) {
|
|
|
|
const smallVideo = VideoLayout.getSmallVideo(id);
|
|
|
|
|
|
|
|
|
2016-03-15 18:36:17 +00:00
|
|
|
return smallVideo ? smallVideo.getVideoType() : null;
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-11-16 23:42:21 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
isPinned(id) {
|
2017-08-10 20:51:35 +00:00
|
|
|
return id === this.getPinnedId();
|
2016-03-24 01:43:29 +00:00
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
getPinnedId() {
|
2017-08-10 20:51:35 +00:00
|
|
|
const { id } = getPinnedParticipant(APP.store.getState()) || {};
|
|
|
|
|
|
|
|
return id || null;
|
|
|
|
},
|
|
|
|
|
2018-11-30 22:13:39 +00:00
|
|
|
/**
|
|
|
|
* Triggers a thumbnail to pin or unpin itself.
|
|
|
|
*
|
|
|
|
* @param {number} videoNumber - The index of the video to toggle pin on.
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
togglePin(videoNumber) {
|
|
|
|
const videos = getAllThumbnails();
|
|
|
|
const videoView = videos[videoNumber];
|
|
|
|
|
|
|
|
videoView && videoView.togglePin();
|
|
|
|
},
|
|
|
|
|
2017-08-10 20:51:35 +00:00
|
|
|
/**
|
2018-05-18 19:59:07 +00:00
|
|
|
* Callback invoked to update display when the pin participant has changed.
|
2017-08-10 20:51:35 +00:00
|
|
|
*
|
2018-05-18 19:59:07 +00:00
|
|
|
* @paramn {string|null} pinnedParticipantID - The participant ID of the
|
|
|
|
* participant that is pinned or null if no one is pinned.
|
2017-08-10 20:51:35 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-05-18 19:59:07 +00:00
|
|
|
onPinChange(pinnedParticipantID) {
|
|
|
|
if (interfaceConfig.filmStripOnly) {
|
|
|
|
return;
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
|
|
|
|
2018-05-18 19:59:07 +00:00
|
|
|
getAllThumbnails().forEach(thumbnail =>
|
|
|
|
thumbnail.focus(pinnedParticipantID === thumbnail.getId()));
|
2017-06-27 22:56:55 +00:00
|
|
|
|
2018-05-18 19:59:07 +00:00
|
|
|
if (pinnedParticipantID) {
|
|
|
|
this.updateLargeVideo(pinnedParticipantID);
|
|
|
|
} else {
|
|
|
|
const currentDominantSpeakerID
|
|
|
|
= getCurrentRemoteDominantSpeakerID();
|
|
|
|
|
|
|
|
if (currentDominantSpeakerID) {
|
|
|
|
this.updateLargeVideo(currentDominantSpeakerID);
|
2016-11-23 21:35:03 +00:00
|
|
|
} else {
|
2018-05-18 19:59:07 +00:00
|
|
|
// if there is no currentDominantSpeakerID, it can also be
|
2016-11-23 21:35:03 +00:00
|
|
|
// that local participant is the dominant speaker
|
|
|
|
// we should act as a participant has left and was on large
|
|
|
|
// and we should choose somebody (electLastVisibleVideo)
|
|
|
|
this.updateLargeVideo(this.electLastVisibleVideo());
|
2014-06-24 11:59:14 +00:00
|
|
|
}
|
2014-11-24 14:58:50 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
|
|
|
/**
|
2018-05-22 17:13:51 +00:00
|
|
|
* Creates a participant container for the given id.
|
2016-04-26 21:38:07 +00:00
|
|
|
*
|
2018-05-22 17:13:51 +00:00
|
|
|
* @param {Object} participant - The redux representation of a remote
|
|
|
|
* participant.
|
|
|
|
* @returns {void}
|
2014-06-12 18:33:57 +00:00
|
|
|
*/
|
2018-05-22 17:13:51 +00:00
|
|
|
addRemoteParticipantContainer(participant) {
|
|
|
|
if (!participant || participant.local) {
|
|
|
|
return;
|
2018-06-22 18:59:54 +00:00
|
|
|
} else if (participant.isFakeParticipant) {
|
2018-05-22 17:13:51 +00:00
|
|
|
const sharedVideoThumb = new SharedVideoThumb(
|
|
|
|
participant,
|
|
|
|
SHARED_VIDEO_CONTAINER_TYPE,
|
|
|
|
VideoLayout);
|
|
|
|
|
|
|
|
this.addRemoteVideoContainer(participant.id, sharedVideoThumb);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const id = participant.id;
|
|
|
|
const jitsiParticipant = APP.conference.getParticipantById(id);
|
|
|
|
const remoteVideo
|
|
|
|
= new RemoteVideo(jitsiParticipant, VideoLayout, eventEmitter);
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2018-05-22 17:13:51 +00:00
|
|
|
this._setRemoteControlProperties(jitsiParticipant, remoteVideo);
|
2016-09-16 20:17:00 +00:00
|
|
|
this.addRemoteVideoContainer(id, remoteVideo);
|
2017-05-25 16:50:52 +00:00
|
|
|
|
2017-07-19 10:08:51 +00:00
|
|
|
this.updateMutedForNoTracks(id, 'audio');
|
|
|
|
this.updateMutedForNoTracks(id, 'video');
|
|
|
|
|
2017-05-25 16:50:52 +00:00
|
|
|
const remoteVideosCount = Object.keys(remoteVideos).length;
|
|
|
|
|
|
|
|
if (remoteVideosCount === 1) {
|
|
|
|
window.setTimeout(() => {
|
|
|
|
const updatedRemoteVideosCount
|
|
|
|
= Object.keys(remoteVideos).length;
|
|
|
|
|
|
|
|
if (updatedRemoteVideosCount === 1 && remoteVideos[id]) {
|
|
|
|
this._maybePlaceParticipantOnLargeVideo(id);
|
|
|
|
}
|
|
|
|
}, 3000);
|
|
|
|
}
|
2016-09-16 20:17:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds remote video container for the given id and <tt>SmallVideo</tt>.
|
|
|
|
*
|
|
|
|
* @param {string} the id of the video to add
|
|
|
|
* @param {SmallVideo} smallVideo the small video instance to add as a
|
|
|
|
* remote video
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
addRemoteVideoContainer(id, remoteVideo) {
|
2015-12-14 12:26:50 +00:00
|
|
|
remoteVideos[id] = remoteVideo;
|
2015-08-05 12:09:12 +00:00
|
|
|
|
2016-11-08 02:39:28 +00:00
|
|
|
if (!remoteVideo.getVideoType()) {
|
2016-03-15 18:36:17 +00:00
|
|
|
// make video type the default one (camera)
|
2016-09-21 20:02:19 +00:00
|
|
|
// FIXME container type is not a video type
|
2016-11-08 02:39:28 +00:00
|
|
|
remoteVideo.setVideoType(VIDEO_CONTAINER_TYPE);
|
2015-12-14 12:26:50 +00:00
|
|
|
}
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2018-04-10 20:03:44 +00:00
|
|
|
VideoLayout.resizeThumbnails(true);
|
2017-03-21 17:14:13 +00:00
|
|
|
|
2016-09-16 20:51:19 +00:00
|
|
|
// Initialize the view
|
|
|
|
remoteVideo.updateView();
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
2016-11-08 02:47:43 +00:00
|
|
|
// FIXME: what does this do???
|
|
|
|
remoteVideoActive(videoElement, resourceJid) {
|
2015-07-20 17:32:04 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info(`${resourceJid} video is now active`, videoElement);
|
2015-07-20 17:32:04 +00:00
|
|
|
|
2016-03-02 19:21:26 +00:00
|
|
|
VideoLayout.resizeThumbnails(
|
2018-04-10 20:03:44 +00:00
|
|
|
false, () => {
|
2017-05-25 16:50:52 +00:00
|
|
|
if (videoElement) {
|
|
|
|
$(videoElement).show();
|
|
|
|
}
|
|
|
|
});
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2017-05-25 16:50:52 +00:00
|
|
|
this._maybePlaceParticipantOnLargeVideo(resourceJid);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the large video to the last added video only if there's no current
|
|
|
|
* dominant, focused speaker or update it to the current dominant speaker.
|
|
|
|
*
|
|
|
|
* @params {string} resourceJid - The id of the user to maybe display on
|
|
|
|
* large video.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_maybePlaceParticipantOnLargeVideo(resourceJid) {
|
2017-08-10 20:51:35 +00:00
|
|
|
const pinnedId = this.getPinnedId();
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
if ((!pinnedId
|
2018-05-18 00:41:28 +00:00
|
|
|
&& !getCurrentRemoteDominantSpeakerID()
|
2017-10-12 23:02:29 +00:00
|
|
|
&& this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE))
|
|
|
|
|| pinnedId === resourceJid
|
|
|
|
|| (!pinnedId && resourceJid
|
2018-05-18 00:41:28 +00:00
|
|
|
&& getCurrentRemoteDominantSpeakerID() === resourceJid)
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-04-26 20:42:18 +00:00
|
|
|
/* Playback started while we're on the stage - may need to update
|
|
|
|
video source with the new stream */
|
2017-10-12 23:02:29 +00:00
|
|
|
|| this.isCurrentlyOnLarge(resourceJid)) {
|
2016-04-26 20:42:18 +00:00
|
|
|
|
2015-12-25 16:55:45 +00:00
|
|
|
this.updateLargeVideo(resourceJid, true);
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
|
|
|
/**
|
2014-11-28 15:17:53 +00:00
|
|
|
* Shows a visual indicator for the moderator of the conference.
|
2016-01-13 21:17:33 +00:00
|
|
|
* On local or remote participants.
|
2014-06-12 18:33:57 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
showModeratorIndicator() {
|
|
|
|
const isModerator = APP.conference.isModerator;
|
|
|
|
|
2015-01-07 09:38:15 +00:00
|
|
|
if (isModerator) {
|
2016-09-28 21:31:40 +00:00
|
|
|
localVideoThumbnail.addModeratorIndicator();
|
2016-07-08 01:44:04 +00:00
|
|
|
} else {
|
2016-09-28 21:31:40 +00:00
|
|
|
localVideoThumbnail.removeModeratorIndicator();
|
2014-12-16 13:54:13 +00:00
|
|
|
}
|
2015-01-19 09:20:00 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
APP.conference.listMembers().forEach(member => {
|
|
|
|
const id = member.getId();
|
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
|
|
|
if (!remoteVideo) {
|
2016-04-27 20:52:07 +00:00
|
|
|
return;
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-04-27 20:52:07 +00:00
|
|
|
|
2015-12-14 12:26:50 +00:00
|
|
|
if (member.isModerator()) {
|
2016-09-28 21:31:40 +00:00
|
|
|
remoteVideo.addModeratorIndicator();
|
2016-09-23 22:42:29 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 19:07:31 +00:00
|
|
|
remoteVideo.updateRemoteVideoMenu();
|
2014-12-16 13:54:13 +00:00
|
|
|
});
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
2014-10-13 08:29:07 +00:00
|
|
|
/*
|
|
|
|
* Shows or hides the audio muted indicator over the local thumbnail video.
|
|
|
|
* @param {boolean} isMuted
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
showLocalAudioIndicator(isMuted) {
|
2015-06-30 11:34:11 +00:00
|
|
|
localVideoThumbnail.showAudioIndicator(isMuted);
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-10-13 08:29:07 +00:00
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
/**
|
|
|
|
* Resizes thumbnails.
|
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
resizeThumbnails(
|
|
|
|
forceUpdate = false,
|
|
|
|
onComplete = null) {
|
2016-10-03 16:12:04 +00:00
|
|
|
const { localVideo, remoteVideo }
|
2017-04-10 17:59:44 +00:00
|
|
|
= Filmstrip.calculateThumbnailSize();
|
2014-07-14 10:33:57 +00:00
|
|
|
|
2018-04-10 20:03:44 +00:00
|
|
|
Filmstrip.resizeThumbnails(localVideo, remoteVideo, forceUpdate);
|
2018-04-10 20:01:12 +00:00
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
if (shouldDisplayTileView(APP.store.getState())) {
|
|
|
|
const height
|
|
|
|
= (localVideo && localVideo.thumbHeight)
|
|
|
|
|| (remoteVideo && remoteVideo.thumbnHeight)
|
|
|
|
|| 0;
|
|
|
|
const qualityLevel = getNearestReceiverVideoQualityLevel(height);
|
|
|
|
|
|
|
|
APP.store.dispatch(setMaxReceiverVideoQuality(qualityLevel));
|
|
|
|
}
|
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
if (onComplete && typeof onComplete === 'function') {
|
|
|
|
onComplete();
|
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
2014-06-27 16:27:24 +00:00
|
|
|
/**
|
|
|
|
* On audio muted event.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
onAudioMute(id, isMuted) {
|
2016-01-06 22:39:13 +00:00
|
|
|
if (APP.conference.isLocalId(id)) {
|
2015-06-23 08:00:46 +00:00
|
|
|
localVideoThumbnail.showAudioIndicator(isMuted);
|
2014-11-28 15:17:53 +00:00
|
|
|
} else {
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
|
|
|
if (!remoteVideo) {
|
2016-04-28 22:50:28 +00:00
|
|
|
return;
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-04-28 22:50:28 +00:00
|
|
|
|
|
|
|
remoteVideo.showAudioIndicator(isMuted);
|
2017-08-17 16:43:22 +00:00
|
|
|
remoteVideo.updateRemoteVideoMenu(isMuted);
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
2014-06-27 16:27:24 +00:00
|
|
|
/**
|
|
|
|
* On video muted event.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
onVideoMute(id, value) {
|
2016-01-06 22:39:13 +00:00
|
|
|
if (APP.conference.isLocalId(id)) {
|
2016-09-28 21:31:40 +00:00
|
|
|
localVideoThumbnail.setVideoMutedView(value);
|
2014-06-12 18:33:57 +00:00
|
|
|
} else {
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
|
|
|
if (remoteVideo) {
|
2016-09-28 21:31:40 +00:00
|
|
|
remoteVideo.setVideoMutedView(value);
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2016-01-14 16:28:24 +00:00
|
|
|
|
2016-02-10 15:16:55 +00:00
|
|
|
if (this.isCurrentlyOnLarge(id)) {
|
|
|
|
// large video will show avatar instead of muted stream
|
|
|
|
this.updateLargeVideo(id, true);
|
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
/**
|
|
|
|
* Display name changed.
|
|
|
|
*/
|
2019-03-26 16:34:02 +00:00
|
|
|
onDisplayNameChanged(id) {
|
2017-10-12 23:02:29 +00:00
|
|
|
if (id === 'localVideoContainer'
|
|
|
|
|| APP.conference.isLocalId(id)) {
|
2019-03-26 16:34:02 +00:00
|
|
|
localVideoThumbnail.updateDisplayName();
|
2014-08-22 15:37:11 +00:00
|
|
|
} else {
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
|
|
|
if (remoteVideo) {
|
2019-03-26 16:34:02 +00:00
|
|
|
remoteVideo.updateDisplayName();
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2014-08-22 15:37:11 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2014-06-24 11:59:14 +00:00
|
|
|
/**
|
2014-07-16 14:35:54 +00:00
|
|
|
* On dominant speaker changed event.
|
2018-05-18 00:41:28 +00:00
|
|
|
*
|
|
|
|
* @param {string} id - The participant ID of the new dominant speaker.
|
|
|
|
* @returns {void}
|
2014-06-24 11:59:14 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
onDominantSpeakerChanged(id) {
|
2018-05-18 19:59:07 +00:00
|
|
|
getAllThumbnails().forEach(thumbnail =>
|
|
|
|
thumbnail.showDominantSpeakerIndicator(id === thumbnail.getId()));
|
2017-10-12 23:02:29 +00:00
|
|
|
|
|
|
|
|
2018-05-18 00:41:28 +00:00
|
|
|
if (!remoteVideos[id]) {
|
2015-08-21 14:26:39 +00:00
|
|
|
return;
|
2015-12-14 12:26:50 +00:00
|
|
|
}
|
|
|
|
|
2014-06-24 11:59:14 +00:00
|
|
|
// Local video will not have container found, but that's ok
|
|
|
|
// since we don't want to switch to local video.
|
2017-08-10 20:51:35 +00:00
|
|
|
if (!interfaceConfig.filmStripOnly && !this.getPinnedId()
|
2016-03-18 03:19:09 +00:00
|
|
|
&& !this.getCurrentlyOnLargeContainer().stayOnStage()) {
|
2016-02-01 22:08:15 +00:00
|
|
|
this.updateLargeVideo(id);
|
2014-08-22 15:37:11 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2016-09-16 20:51:19 +00:00
|
|
|
/**
|
2018-06-25 17:44:12 +00:00
|
|
|
* Shows/hides warning about a user's connectivity issues.
|
2016-09-16 20:51:19 +00:00
|
|
|
*
|
2018-06-25 17:44:12 +00:00
|
|
|
* @param {string} id - The ID of the remote participant(MUC nickname).
|
|
|
|
* @param {status} status - The new connection status.
|
|
|
|
* @returns {void}
|
2016-09-16 20:51:19 +00:00
|
|
|
*/
|
2018-06-25 17:44:12 +00:00
|
|
|
onParticipantConnectionStatusChanged(id, status) {
|
|
|
|
if (APP.conference.isLocalId(id)) {
|
|
|
|
// Maintain old logic of passing in either interrupted or active
|
|
|
|
// to updateConnectionStatus.
|
|
|
|
localVideoThumbnail.updateConnectionStatus(status);
|
|
|
|
|
|
|
|
if (status === JitsiParticipantConnectionStatus.INTERRUPTED) {
|
|
|
|
largeVideo && largeVideo.onVideoInterrupted();
|
|
|
|
} else {
|
|
|
|
largeVideo && largeVideo.onVideoRestored();
|
2016-09-24 18:24:18 +00:00
|
|
|
}
|
2018-06-25 17:44:12 +00:00
|
|
|
|
|
|
|
return;
|
2016-09-24 18:24:18 +00:00
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2018-06-25 17:44:12 +00:00
|
|
|
// We have to trigger full large video update to transition from
|
|
|
|
// avatar to video on connectivity restored.
|
|
|
|
this._updateLargeVideoIfDisplayed(id, true);
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
2016-09-16 20:51:19 +00:00
|
|
|
if (remoteVideo) {
|
2016-09-24 15:36:24 +00:00
|
|
|
// Updating only connection status indicator is not enough, because
|
|
|
|
// when we the connection is restored while the avatar was displayed
|
|
|
|
// (due to 'muted while disconnected' condition) we may want to show
|
|
|
|
// the video stream again and in order to do that the display mode
|
|
|
|
// must be updated.
|
2017-10-12 23:02:29 +00:00
|
|
|
// remoteVideo.updateConnectionStatusIndicator(isActive);
|
2016-09-24 15:36:24 +00:00
|
|
|
remoteVideo.updateView();
|
2016-09-16 20:51:19 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-08-22 15:37:11 +00:00
|
|
|
/**
|
|
|
|
* On last N change event.
|
|
|
|
*
|
2017-03-21 21:51:49 +00:00
|
|
|
* @param endpointsLeavingLastN the list currently leaving last N
|
|
|
|
* endpoints
|
2014-08-22 15:37:11 +00:00
|
|
|
* @param endpointsEnteringLastN the list currently entering last N
|
|
|
|
* endpoints
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
onLastNEndpointsChanged(endpointsLeavingLastN, endpointsEnteringLastN) {
|
2017-03-21 21:51:49 +00:00
|
|
|
if (endpointsLeavingLastN) {
|
|
|
|
endpointsLeavingLastN.forEach(this._updateRemoteVideo, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (endpointsEnteringLastN) {
|
|
|
|
endpointsEnteringLastN.forEach(this._updateRemoteVideo, this);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates remote video by id if it exists.
|
|
|
|
* @param {string} id of the remote video
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_updateRemoteVideo(id) {
|
|
|
|
const remoteVideo = remoteVideos[id];
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2017-03-21 21:51:49 +00:00
|
|
|
if (remoteVideo) {
|
|
|
|
remoteVideo.updateView();
|
|
|
|
if (remoteVideo.isCurrentlyOnLargeVideo()) {
|
2017-07-10 10:06:48 +00:00
|
|
|
this.updateLargeVideo(id);
|
2017-03-21 21:51:49 +00:00
|
|
|
}
|
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2014-10-16 15:11:26 +00:00
|
|
|
/**
|
|
|
|
* Hides the connection indicator
|
2015-12-14 15:40:30 +00:00
|
|
|
* @param id
|
2014-10-16 15:11:26 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
hideConnectionIndicator(id) {
|
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
|
|
|
if (remoteVideo) {
|
2017-06-19 20:20:13 +00:00
|
|
|
remoteVideo.removeConnectionIndicator();
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-10-16 15:11:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides all the indicators
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
hideStats() {
|
|
|
|
for (const video in remoteVideos) { // eslint-disable-line guard-for-in
|
|
|
|
const remoteVideo = remoteVideos[video];
|
|
|
|
|
|
|
|
if (remoteVideo) {
|
2017-07-18 20:27:48 +00:00
|
|
|
remoteVideo.removeConnectionIndicator();
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2014-10-16 15:11:26 +00:00
|
|
|
}
|
2017-07-18 20:27:48 +00:00
|
|
|
localVideoThumbnail.removeConnectionIndicator();
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2014-10-16 15:11:26 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
removeParticipantContainer(id) {
|
2015-01-20 15:56:00 +00:00
|
|
|
// Unlock large video
|
2017-08-10 20:51:35 +00:00
|
|
|
if (this.getPinnedId() === id) {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info('Focused video owner has left the conference');
|
2018-05-18 19:59:07 +00:00
|
|
|
APP.store.dispatch(pinParticipant(null));
|
2015-01-20 15:56:00 +00:00
|
|
|
}
|
2015-07-23 09:03:29 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteVideo = remoteVideos[id];
|
|
|
|
|
2015-07-23 09:03:29 +00:00
|
|
|
if (remoteVideo) {
|
|
|
|
// Remove remote video
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info(`Removing remote video: ${id}`);
|
2015-12-14 12:26:50 +00:00
|
|
|
delete remoteVideos[id];
|
2015-10-01 22:46:42 +00:00
|
|
|
remoteVideo.remove();
|
2015-07-23 09:03:29 +00:00
|
|
|
} else {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.warn(`No remote video for ${id}`);
|
2015-07-23 09:03:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VideoLayout.resizeThumbnails();
|
2018-05-21 21:22:41 +00:00
|
|
|
VideoLayout._updateAfterThumbRemoved(id);
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-11-30 11:54:54 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
onVideoTypeChanged(id, newVideoType) {
|
2016-03-15 18:36:17 +00:00
|
|
|
if (VideoLayout.getRemoteVideoType(id) === newVideoType) {
|
2015-08-05 12:09:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.info('Peer video type changed: ', id, newVideoType);
|
|
|
|
|
|
|
|
let smallVideo;
|
2015-08-05 12:09:12 +00:00
|
|
|
|
2015-12-14 12:26:50 +00:00
|
|
|
if (APP.conference.isLocalId(id)) {
|
2015-08-05 12:09:12 +00:00
|
|
|
if (!localVideoThumbnail) {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.warn('Local video not ready yet');
|
|
|
|
|
2015-08-05 12:09:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
smallVideo = localVideoThumbnail;
|
2015-12-14 12:26:50 +00:00
|
|
|
} else if (remoteVideos[id]) {
|
|
|
|
smallVideo = remoteVideos[id];
|
2015-08-05 12:09:12 +00:00
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
smallVideo.setVideoType(newVideoType);
|
2016-03-15 18:36:17 +00:00
|
|
|
|
2015-12-25 16:55:45 +00:00
|
|
|
if (this.isCurrentlyOnLarge(id)) {
|
|
|
|
this.updateLargeVideo(id, true);
|
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-11-13 17:04:49 +00:00
|
|
|
|
2015-06-23 08:00:46 +00:00
|
|
|
/**
|
2015-11-13 17:04:49 +00:00
|
|
|
* Resizes the video area.
|
|
|
|
*
|
2018-05-16 14:00:16 +00:00
|
|
|
* TODO: Remove the "animate" param as it is no longer passed in as true.
|
|
|
|
*
|
2016-02-24 21:05:24 +00:00
|
|
|
* @param forceUpdate indicates that hidden thumbnails will be shown
|
2016-03-15 21:03:38 +00:00
|
|
|
*/
|
2017-10-02 23:08:07 +00:00
|
|
|
resizeVideoArea(
|
|
|
|
forceUpdate = false,
|
2018-05-11 18:34:03 +00:00
|
|
|
animate = false) {
|
2018-07-26 18:45:04 +00:00
|
|
|
// Resize the thumbnails first.
|
|
|
|
this.resizeThumbnails(forceUpdate);
|
|
|
|
|
2015-12-25 16:55:45 +00:00
|
|
|
if (largeVideo) {
|
2016-09-08 18:16:23 +00:00
|
|
|
largeVideo.updateContainerSize();
|
2015-12-25 16:55:45 +00:00
|
|
|
largeVideo.resize(animate);
|
|
|
|
}
|
|
|
|
|
2016-02-24 21:05:24 +00:00
|
|
|
// Calculate available width and height.
|
2017-10-12 23:02:29 +00:00
|
|
|
const availableHeight = window.innerHeight;
|
|
|
|
const availableWidth = UIUtil.getAvailableVideoWidth();
|
2016-01-20 14:26:39 +00:00
|
|
|
|
|
|
|
if (availableWidth < 0 || availableHeight < 0) {
|
|
|
|
return;
|
2015-08-06 23:34:40 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-08-06 23:34:40 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
getSmallVideo(id) {
|
2015-12-14 12:26:50 +00:00
|
|
|
if (APP.conference.isLocalId(id)) {
|
2015-06-23 08:00:46 +00:00
|
|
|
return localVideoThumbnail;
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
|
|
|
return remoteVideos[id];
|
|
|
|
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-06-29 14:24:21 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
changeUserAvatar(id, avatarUrl) {
|
|
|
|
const smallVideo = VideoLayout.getSmallVideo(id);
|
|
|
|
|
2015-12-02 15:24:57 +00:00
|
|
|
if (smallVideo) {
|
2016-01-19 23:10:44 +00:00
|
|
|
smallVideo.avatarChanged(avatarUrl);
|
2015-12-02 15:24:57 +00:00
|
|
|
} else {
|
2016-11-11 15:00:54 +00:00
|
|
|
logger.warn(
|
2017-10-12 23:02:29 +00:00
|
|
|
`Missed avatar update - no small video yet for ${id}`
|
2015-12-02 15:24:57 +00:00
|
|
|
);
|
|
|
|
}
|
2015-12-25 16:55:45 +00:00
|
|
|
if (this.isCurrentlyOnLarge(id)) {
|
2016-01-19 23:10:44 +00:00
|
|
|
largeVideo.updateAvatar(avatarUrl);
|
2015-12-25 16:55:45 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
},
|
2015-07-29 19:39:09 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
isLargeVideoVisible() {
|
2016-03-18 20:00:55 +00:00
|
|
|
return this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE);
|
2015-12-25 16:55:45 +00:00
|
|
|
},
|
|
|
|
|
2016-03-18 03:19:09 +00:00
|
|
|
/**
|
|
|
|
* @return {LargeContainer} the currently displayed container on large
|
|
|
|
* video.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
getCurrentlyOnLargeContainer() {
|
2017-07-10 09:02:22 +00:00
|
|
|
return largeVideo.getCurrentContainer();
|
2016-03-18 03:19:09 +00:00
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
isCurrentlyOnLarge(id) {
|
2015-12-25 16:55:45 +00:00
|
|
|
return largeVideo && largeVideo.id === id;
|
|
|
|
},
|
|
|
|
|
2017-04-05 15:14:26 +00:00
|
|
|
/**
|
|
|
|
* Triggers an update of remote video and large video displays so they may
|
|
|
|
* pick up any state changes that have occurred elsewhere.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
updateAllVideos() {
|
|
|
|
const displayedUserId = this.getLargeVideoID();
|
|
|
|
|
|
|
|
if (displayedUserId) {
|
|
|
|
this.updateLargeVideo(displayedUserId, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
Object.keys(remoteVideos).forEach(video => {
|
|
|
|
remoteVideos[video].updateView();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
updateLargeVideo(id, forceUpdate) {
|
2015-12-25 16:55:45 +00:00
|
|
|
if (!largeVideo) {
|
|
|
|
return;
|
|
|
|
}
|
2017-07-10 10:06:48 +00:00
|
|
|
const currentContainer = largeVideo.getCurrentContainer();
|
|
|
|
const currentContainerType = largeVideo.getCurrentContainerType();
|
|
|
|
const currentId = largeVideo.id;
|
|
|
|
const isOnLarge = this.isCurrentlyOnLarge(id);
|
|
|
|
const smallVideo = this.getSmallVideo(id);
|
|
|
|
|
|
|
|
if (isOnLarge && !forceUpdate
|
|
|
|
&& LargeVideoManager.isVideoContainer(currentContainerType)
|
|
|
|
&& smallVideo) {
|
|
|
|
const currentStreamId = currentContainer.getStreamID();
|
|
|
|
const newStreamId
|
|
|
|
= smallVideo.videoStream
|
|
|
|
? smallVideo.videoStream.getId() : null;
|
|
|
|
|
|
|
|
// FIXME it might be possible to get rid of 'forceUpdate' argument
|
|
|
|
if (currentStreamId !== newStreamId) {
|
|
|
|
logger.debug('Enforcing large video update for stream change');
|
2017-10-12 23:02:29 +00:00
|
|
|
forceUpdate = true; // eslint-disable-line no-param-reassign
|
2017-07-10 10:06:48 +00:00
|
|
|
}
|
|
|
|
}
|
2015-12-25 16:55:45 +00:00
|
|
|
|
2018-07-10 00:04:54 +00:00
|
|
|
if ((!isOnLarge || forceUpdate) && smallVideo) {
|
2017-10-12 23:02:29 +00:00
|
|
|
const videoType = this.getRemoteVideoType(id);
|
|
|
|
|
2016-09-21 20:02:19 +00:00
|
|
|
// FIXME video type is not the same thing as container type
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-03-24 19:34:18 +00:00
|
|
|
if (id !== currentId && videoType === VIDEO_CONTAINER_TYPE) {
|
2018-07-20 18:19:26 +00:00
|
|
|
APP.API.notifyOnStageParticipantChanged(id);
|
2015-12-25 16:55:45 +00:00
|
|
|
}
|
2016-07-08 20:14:49 +00:00
|
|
|
|
|
|
|
let oldSmallVideo;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2015-12-25 16:55:45 +00:00
|
|
|
if (currentId) {
|
2016-07-08 20:14:49 +00:00
|
|
|
oldSmallVideo = this.getSmallVideo(currentId);
|
2015-12-25 16:55:45 +00:00
|
|
|
}
|
|
|
|
|
2016-07-08 20:14:49 +00:00
|
|
|
smallVideo.waitForResolutionChange();
|
2017-10-12 23:02:29 +00:00
|
|
|
if (oldSmallVideo) {
|
2016-07-08 20:14:49 +00:00
|
|
|
oldSmallVideo.waitForResolutionChange();
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2015-12-25 16:55:45 +00:00
|
|
|
|
2016-01-14 16:28:24 +00:00
|
|
|
largeVideo.updateLargeVideo(
|
2016-01-29 19:31:58 +00:00
|
|
|
id,
|
2016-01-29 00:33:27 +00:00
|
|
|
smallVideo.videoStream,
|
2018-07-02 15:39:28 +00:00
|
|
|
videoType || VIDEO_TYPE.CAMERA
|
2017-10-12 23:02:29 +00:00
|
|
|
).then(() => {
|
2016-01-22 15:08:58 +00:00
|
|
|
// update current small video and the old one
|
|
|
|
smallVideo.updateView();
|
|
|
|
oldSmallVideo && oldSmallVideo.updateView();
|
2017-10-12 23:02:29 +00:00
|
|
|
}, () => {
|
2016-01-22 15:08:58 +00:00
|
|
|
// use clicked other video during update, nothing to do.
|
|
|
|
});
|
2015-12-25 16:55:45 +00:00
|
|
|
|
|
|
|
} else if (currentId) {
|
2017-10-12 23:02:29 +00:00
|
|
|
const currentSmallVideo = this.getSmallVideo(currentId);
|
|
|
|
|
2016-01-14 16:28:24 +00:00
|
|
|
currentSmallVideo.updateView();
|
2015-12-25 16:55:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
addLargeVideoContainer(type, container) {
|
2015-12-25 16:55:45 +00:00
|
|
|
largeVideo && largeVideo.addContainer(type, container);
|
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
removeLargeVideoContainer(type) {
|
2015-12-25 16:55:45 +00:00
|
|
|
largeVideo && largeVideo.removeContainer(type);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns Promise
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
showLargeVideoContainer(type, show) {
|
2015-12-25 16:55:45 +00:00
|
|
|
if (!largeVideo) {
|
|
|
|
return Promise.reject();
|
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const isVisible = this.isLargeContainerTypeVisible(type);
|
|
|
|
|
2015-12-25 16:55:45 +00:00
|
|
|
if (isVisible === show) {
|
|
|
|
return Promise.resolve();
|
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const currentId = largeVideo.id;
|
|
|
|
let oldSmallVideo;
|
|
|
|
|
|
|
|
if (currentId) {
|
|
|
|
oldSmallVideo = this.getSmallVideo(currentId);
|
2016-03-18 20:00:55 +00:00
|
|
|
}
|
|
|
|
|
2016-03-22 21:12:25 +00:00
|
|
|
let containerTypeToShow = type;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-03-22 21:12:25 +00:00
|
|
|
// if we are hiding a container and there is focusedVideo
|
|
|
|
// (pinned remote video) use its video type,
|
|
|
|
// if not then use default type - large video
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-03-22 21:12:25 +00:00
|
|
|
if (!show) {
|
2017-08-10 20:51:35 +00:00
|
|
|
const pinnedId = this.getPinnedId();
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
if (pinnedId) {
|
2016-03-24 18:16:42 +00:00
|
|
|
containerTypeToShow = this.getRemoteVideoType(pinnedId);
|
2017-10-12 23:02:29 +00:00
|
|
|
} else {
|
2016-03-22 21:12:25 +00:00
|
|
|
containerTypeToShow = VIDEO_CONTAINER_TYPE;
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-03-22 21:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return largeVideo.showContainer(containerTypeToShow)
|
2016-03-18 20:00:55 +00:00
|
|
|
.then(() => {
|
2017-10-12 23:02:29 +00:00
|
|
|
if (oldSmallVideo) {
|
2016-03-18 20:00:55 +00:00
|
|
|
oldSmallVideo && oldSmallVideo.updateView();
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2016-03-18 20:00:55 +00:00
|
|
|
});
|
2015-12-25 16:55:45 +00:00
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
isLargeContainerTypeVisible(type) {
|
2015-12-25 16:55:45 +00:00
|
|
|
return largeVideo && largeVideo.state === type;
|
2016-01-14 19:30:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the id of the current video shown on large.
|
2016-03-18 20:00:55 +00:00
|
|
|
* Currently used by tests (torture).
|
2016-01-14 19:30:27 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
getLargeVideoID() {
|
2018-04-12 21:23:03 +00:00
|
|
|
return largeVideo && largeVideo.id;
|
2016-03-18 20:00:55 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the the current video shown on large.
|
|
|
|
* Currently used by tests (torture).
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
getLargeVideo() {
|
2016-03-18 20:00:55 +00:00
|
|
|
return largeVideo;
|
2016-03-15 20:26:22 +00:00
|
|
|
},
|
|
|
|
|
2016-05-07 01:50:37 +00:00
|
|
|
/**
|
|
|
|
* Sets the flipX state of the local video.
|
|
|
|
* @param {boolean} true for flipped otherwise false;
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
setLocalFlipX(val) {
|
2016-05-07 01:50:37 +00:00
|
|
|
this.localFlipX = val;
|
2017-01-06 01:18:07 +00:00
|
|
|
},
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
getEventEmitter() {
|
|
|
|
return eventEmitter;
|
|
|
|
},
|
2017-01-06 01:18:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles user's features changes.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
onUserFeaturesChanged(user) {
|
|
|
|
const video = this.getSmallVideo(user.getId());
|
2016-05-07 01:50:37 +00:00
|
|
|
|
2017-01-06 01:18:07 +00:00
|
|
|
if (!video) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this._setRemoteControlProperties(user, video);
|
2016-07-08 20:14:49 +00:00
|
|
|
},
|
|
|
|
|
2017-01-06 01:18:07 +00:00
|
|
|
/**
|
|
|
|
* Sets the remote control properties (checks whether remote control
|
|
|
|
* is supported and executes remoteVideo.setRemoteControlSupport).
|
|
|
|
* @param {JitsiParticipant} user the user that will be checked for remote
|
|
|
|
* control support.
|
|
|
|
* @param {RemoteVideo} remoteVideo the remoteVideo on which the properties
|
|
|
|
* will be set.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
_setRemoteControlProperties(user, remoteVideo) {
|
2017-01-06 01:18:07 +00:00
|
|
|
APP.remoteControl.checkUserRemoteControlSupport(user).then(result =>
|
|
|
|
remoteVideo.setRemoteControlSupport(result));
|
2017-01-20 20:26:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the wrapper jquery selector for the largeVideo
|
|
|
|
* @returns {JQuerySelector} the wrapper jquery selector for the largeVideo
|
|
|
|
*/
|
|
|
|
getLargeVideoWrapper() {
|
|
|
|
return this.getCurrentlyOnLargeContainer().$wrapper;
|
2017-05-19 00:40:14 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of remove video ids.
|
|
|
|
*
|
|
|
|
* @returns {number} The number of remote videos.
|
|
|
|
*/
|
|
|
|
getRemoteVideosCount() {
|
|
|
|
return Object.keys(remoteVideos).length;
|
2017-08-17 16:43:22 +00:00
|
|
|
},
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2017-08-17 16:43:22 +00:00
|
|
|
/**
|
|
|
|
* Sets the remote control active status for a remote participant.
|
|
|
|
*
|
|
|
|
* @param {string} participantID - The id of the remote participant.
|
|
|
|
* @param {boolean} isActive - The new remote control active status.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
setRemoteControlActiveStatus(participantID, isActive) {
|
|
|
|
remoteVideos[participantID].setRemoteControlActiveStatus(isActive);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the remote control active status for the local participant.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
setLocalRemoteControlActiveChanged() {
|
|
|
|
Object.values(remoteVideos).forEach(
|
|
|
|
remoteVideo => remoteVideo.updateRemoteVideoMenu()
|
|
|
|
);
|
2018-05-21 22:10:43 +00:00
|
|
|
},
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
/**
|
|
|
|
* Helper method to invoke when the video layout has changed and elements
|
|
|
|
* have to be re-arranged and resized.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
refreshLayout() {
|
|
|
|
localVideoThumbnail && localVideoThumbnail.updateDOMLocation();
|
|
|
|
VideoLayout.resizeVideoArea();
|
|
|
|
|
|
|
|
localVideoThumbnail && localVideoThumbnail.rerender();
|
|
|
|
Object.values(remoteVideos).forEach(
|
|
|
|
remoteVideo => remoteVideo.rerender()
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2019-01-01 21:19:34 +00:00
|
|
|
/**
|
|
|
|
* Cleans up any existing largeVideo instance.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_resetLargeVideo() {
|
|
|
|
if (largeVideo) {
|
|
|
|
largeVideo.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
largeVideo = null;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cleans up filmstrip state. While a separate {@code Filmstrip} exists, its
|
|
|
|
* implementation is mainly for querying and manipulating the DOM while
|
|
|
|
* state mostly remains in {@code VideoLayout}.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_resetFilmstrip() {
|
|
|
|
Object.keys(remoteVideos).forEach(remoteVideoId => {
|
|
|
|
this.removeParticipantContainer(remoteVideoId);
|
|
|
|
delete remoteVideos[remoteVideoId];
|
|
|
|
});
|
|
|
|
|
|
|
|
if (localVideoThumbnail) {
|
|
|
|
localVideoThumbnail.remove();
|
|
|
|
localVideoThumbnail = null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-05-21 22:10:43 +00:00
|
|
|
/**
|
|
|
|
* Triggers an update of large video if the passed in participant is
|
|
|
|
* currently displayed on large video.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The participant ID that should trigger an
|
|
|
|
* update of large video if displayed.
|
2018-06-25 17:44:12 +00:00
|
|
|
* @param {boolean} force - Whether or not the large video update should
|
|
|
|
* happen no matter what.
|
2018-05-21 22:10:43 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-06-25 17:44:12 +00:00
|
|
|
_updateLargeVideoIfDisplayed(participantId, force = false) {
|
2018-05-21 22:10:43 +00:00
|
|
|
if (this.isCurrentlyOnLarge(participantId)) {
|
2018-06-25 17:44:12 +00:00
|
|
|
this.updateLargeVideo(participantId, force);
|
2018-05-21 22:10:43 +00:00
|
|
|
}
|
2017-01-06 01:18:07 +00:00
|
|
|
}
|
2015-12-14 12:26:50 +00:00
|
|
|
};
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-12-14 12:26:50 +00:00
|
|
|
export default VideoLayout;
|