2017-10-10 23:31:40 +00:00
|
|
|
/* global $, APP, interfaceConfig */
|
2017-05-31 15:42:50 +00:00
|
|
|
|
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
import React from 'react';
|
2017-06-19 16:01:44 +00:00
|
|
|
import ReactDOM from 'react-dom';
|
2017-07-31 23:33:22 +00:00
|
|
|
import { Provider } from 'react-redux';
|
2017-08-14 15:02:58 +00:00
|
|
|
import { I18nextProvider } from 'react-i18next';
|
2017-10-06 16:14:45 +00:00
|
|
|
import { AtlasKitThemeProvider } from '@atlaskit/theme';
|
2017-08-14 15:02:58 +00:00
|
|
|
|
|
|
|
import { i18next } from '../../../react/features/base/i18n';
|
2017-10-10 23:31:40 +00:00
|
|
|
import {
|
|
|
|
JitsiParticipantConnectionStatus
|
|
|
|
} from '../../../react/features/base/lib-jitsi-meet';
|
2018-05-18 19:59:07 +00:00
|
|
|
import {
|
|
|
|
getPinnedParticipant,
|
|
|
|
pinParticipant
|
|
|
|
} from '../../../react/features/base/participants';
|
2017-07-31 23:33:22 +00:00
|
|
|
import { PresenceLabel } from '../../../react/features/presence-status';
|
2017-05-31 15:42:50 +00:00
|
|
|
import {
|
|
|
|
REMOTE_CONTROL_MENU_STATES,
|
2017-08-14 15:02:58 +00:00
|
|
|
RemoteVideoMenuTriggerButton
|
2017-05-31 15:42:50 +00:00
|
|
|
} from '../../../react/features/remote-video-menu';
|
2020-01-24 16:28:47 +00:00
|
|
|
import { LAYOUTS, getCurrentLayout } from '../../../react/features/video-layout';
|
2017-05-31 15:42:50 +00:00
|
|
|
/* eslint-enable no-unused-vars */
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
2015-12-14 12:26:50 +00:00
|
|
|
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
import SmallVideo from './SmallVideo';
|
|
|
|
import UIUtils from '../util/UIUtil';
|
2015-12-14 12:26:50 +00:00
|
|
|
|
2016-09-16 20:17:00 +00:00
|
|
|
/**
|
2019-12-16 14:15:02 +00:00
|
|
|
*
|
|
|
|
* @param {*} spanId
|
2016-09-16 20:17:00 +00:00
|
|
|
*/
|
2019-12-16 14:15:02 +00:00
|
|
|
function createContainer(spanId) {
|
|
|
|
const container = document.createElement('span');
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
container.id = spanId;
|
|
|
|
container.className = 'videocontainer';
|
2017-07-31 23:33:22 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
container.innerHTML = `
|
|
|
|
<div class = 'videocontainer__background'></div>
|
|
|
|
<div class = 'videocontainer__toptoolbar'></div>
|
|
|
|
<div class = 'videocontainer__toolbar'></div>
|
|
|
|
<div class = 'videocontainer__hoverOverlay'></div>
|
|
|
|
<div class = 'displayNameContainer'></div>
|
|
|
|
<div class = 'avatar-container'></div>
|
|
|
|
<div class ='presence-label-container'></div>
|
|
|
|
<span class = 'remotevideomenu'></span>`;
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
const remoteVideosContainer
|
|
|
|
= document.getElementById('filmstripRemoteVideosContainer');
|
|
|
|
const localVideoContainer
|
|
|
|
= document.getElementById('localVideoTileViewContainer');
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
remoteVideosContainer.insertBefore(container, localVideoContainer);
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
return container;
|
|
|
|
}
|
2016-10-28 16:16:40 +00:00
|
|
|
|
2016-08-04 20:23:38 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2019-12-16 14:15:02 +00:00
|
|
|
export default class RemoteVideo extends SmallVideo {
|
|
|
|
/**
|
|
|
|
* Creates new instance of the <tt>RemoteVideo</tt>.
|
|
|
|
* @param user {JitsiParticipant} the user for whom remote video instance will
|
|
|
|
* be created.
|
|
|
|
* @param {VideoLayout} VideoLayout the video layout instance.
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
constructor(user, VideoLayout) {
|
|
|
|
super(VideoLayout);
|
|
|
|
|
|
|
|
this.user = user;
|
|
|
|
this.id = user.getId();
|
|
|
|
this.videoSpanId = `participant_${this.id}`;
|
|
|
|
|
|
|
|
this._audioStreamElement = null;
|
|
|
|
this._supportsRemoteControl = false;
|
|
|
|
this.statsPopoverLocation = interfaceConfig.VERTICAL_FILMSTRIP ? 'left bottom' : 'top center';
|
|
|
|
this.addRemoteVideoContainer();
|
|
|
|
this.updateIndicators();
|
|
|
|
this.updateDisplayName();
|
|
|
|
this.bindHoverHandler();
|
|
|
|
this.flipX = false;
|
|
|
|
this.isLocal = false;
|
|
|
|
this.popupMenuIsHovered = false;
|
|
|
|
this._isRemoteControlSessionActive = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The flag is set to <tt>true</tt> after the 'onplay' event has been
|
|
|
|
* triggered on the current video element. It goes back to <tt>false</tt>
|
|
|
|
* when the stream is removed. It is used to determine whether the video
|
|
|
|
* playback has ever started.
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
this.wasVideoPlayed = false;
|
2017-08-14 15:02:58 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* The flag is set to <tt>true</tt> if remote participant's video gets muted
|
|
|
|
* during his media connection disruption. This is to prevent black video
|
|
|
|
* being render on the thumbnail, because even though once the video has
|
|
|
|
* been played the image usually remains on the video element it seems that
|
|
|
|
* after longer period of the video element being hidden this image can be
|
|
|
|
* lost.
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
this.mutedWhileDisconnected = false;
|
2017-08-14 15:02:58 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// Bind event handlers so they are only bound once for every instance.
|
|
|
|
// TODO The event handlers should be turned into actions so changes can be
|
|
|
|
// handled through reducers and middleware.
|
|
|
|
this._requestRemoteControlPermissions
|
|
|
|
= this._requestRemoteControlPermissions.bind(this);
|
|
|
|
this._setAudioVolume = this._setAudioVolume.bind(this);
|
|
|
|
this._stopRemoteControl = this._stopRemoteControl.bind(this);
|
2017-08-14 15:02:58 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
this.container.onclick = this._onContainerClick;
|
2017-01-06 01:18:07 +00:00
|
|
|
}
|
2016-08-04 20:23:38 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
addRemoteVideoContainer() {
|
|
|
|
this.container = createContainer(this.videoSpanId);
|
|
|
|
this.$container = $(this.container);
|
2020-02-25 16:54:20 +00:00
|
|
|
this.initializeAvatar();
|
2020-01-24 16:28:47 +00:00
|
|
|
this._setThumbnailSize();
|
2019-12-16 14:15:02 +00:00
|
|
|
this.initBrowserSpecificProperties();
|
|
|
|
this.updateRemoteVideoMenu();
|
2020-02-18 16:31:04 +00:00
|
|
|
this.updateStatusBar();
|
2019-12-16 14:15:02 +00:00
|
|
|
this.addAudioLevelIndicator();
|
|
|
|
this.addPresenceLabel();
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
return this.container;
|
2018-08-08 18:48:23 +00:00
|
|
|
}
|
2017-05-31 15:42:50 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Checks whether current video is considered hovered. Currently it is hovered
|
|
|
|
* if the mouse is over the video, or if the connection indicator or the popup
|
|
|
|
* menu is shown(hovered).
|
|
|
|
* @private
|
|
|
|
* NOTE: extends SmallVideo's method
|
|
|
|
*/
|
|
|
|
_isHovered() {
|
|
|
|
return super._isHovered() || this.popupMenuIsHovered;
|
|
|
|
}
|
2017-08-17 16:43:22 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Generates the popup menu content.
|
|
|
|
*
|
|
|
|
* @returns {Element|*} the constructed element, containing popup menu items
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_generatePopupContent() {
|
|
|
|
if (interfaceConfig.filmStripOnly) {
|
|
|
|
return;
|
|
|
|
}
|
2017-08-14 15:02:58 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
const remoteVideoMenuContainer
|
|
|
|
= this.container.querySelector('.remotevideomenu');
|
2017-01-06 01:18:07 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (!remoteVideoMenuContainer) {
|
2017-01-06 01:18:07 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-12-16 14:15:02 +00:00
|
|
|
|
|
|
|
const { controller } = APP.remoteControl;
|
|
|
|
let remoteControlState = null;
|
|
|
|
let onRemoteControlToggle;
|
|
|
|
|
|
|
|
if (this._supportsRemoteControl
|
|
|
|
&& ((!APP.remoteControl.active && !this._isRemoteControlSessionActive)
|
|
|
|
|| APP.remoteControl.controller.activeParticipant === this.id)) {
|
|
|
|
if (controller.getRequestedParticipant() === this.id) {
|
|
|
|
remoteControlState = REMOTE_CONTROL_MENU_STATES.REQUESTING;
|
|
|
|
} else if (controller.isStarted()) {
|
|
|
|
onRemoteControlToggle = this._stopRemoteControl;
|
|
|
|
remoteControlState = REMOTE_CONTROL_MENU_STATES.STARTED;
|
|
|
|
} else {
|
|
|
|
onRemoteControlToggle = this._requestRemoteControlPermissions;
|
|
|
|
remoteControlState = REMOTE_CONTROL_MENU_STATES.NOT_STARTED;
|
2017-01-20 20:32:30 +00:00
|
|
|
}
|
2017-01-10 18:51:25 +00:00
|
|
|
}
|
2017-01-06 01:18:07 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
const initialVolumeValue = this._audioStreamElement && this._audioStreamElement.volume;
|
2017-01-06 01:18:07 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// hide volume when in silent mode
|
|
|
|
const onVolumeChange
|
|
|
|
= APP.store.getState()['features/base/config'].startSilent ? undefined : this._setAudioVolume;
|
|
|
|
const participantID = this.id;
|
|
|
|
const currentLayout = getCurrentLayout(APP.store.getState());
|
|
|
|
let remoteMenuPosition;
|
2017-02-12 06:02:16 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (currentLayout === LAYOUTS.TILE_VIEW) {
|
|
|
|
remoteMenuPosition = 'left top';
|
|
|
|
} else if (currentLayout === LAYOUTS.VERTICAL_FILMSTRIP_VIEW) {
|
|
|
|
remoteMenuPosition = 'left bottom';
|
|
|
|
} else {
|
|
|
|
remoteMenuPosition = 'top center';
|
|
|
|
}
|
2017-11-02 19:07:31 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
ReactDOM.render(
|
|
|
|
<Provider store = { APP.store }>
|
|
|
|
<I18nextProvider i18n = { i18next }>
|
|
|
|
<AtlasKitThemeProvider mode = 'dark'>
|
|
|
|
<RemoteVideoMenuTriggerButton
|
|
|
|
initialVolumeValue = { initialVolumeValue }
|
|
|
|
isAudioMuted = { this.isAudioMuted }
|
|
|
|
menuPosition = { remoteMenuPosition }
|
|
|
|
onMenuDisplay
|
|
|
|
= {this._onRemoteVideoMenuDisplay.bind(this)}
|
|
|
|
onRemoteControlToggle = { onRemoteControlToggle }
|
|
|
|
onVolumeChange = { onVolumeChange }
|
|
|
|
participantID = { participantID }
|
|
|
|
remoteControlState = { remoteControlState } />
|
|
|
|
</AtlasKitThemeProvider>
|
|
|
|
</I18nextProvider>
|
|
|
|
</Provider>,
|
|
|
|
remoteVideoMenuContainer);
|
2017-11-02 19:07:31 +00:00
|
|
|
}
|
2016-08-04 20:23:38 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
_onRemoteVideoMenuDisplay() {
|
|
|
|
this.updateRemoteVideoMenu();
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Sets the remote control active status for the remote video.
|
|
|
|
*
|
|
|
|
* @param {boolean} isActive - The new remote control active status.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
setRemoteControlActiveStatus(isActive) {
|
|
|
|
this._isRemoteControlSessionActive = isActive;
|
|
|
|
this.updateRemoteVideoMenu();
|
|
|
|
}
|
2016-09-22 21:21:01 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Sets the remote control supported value and initializes or updates the menu
|
|
|
|
* depending on the remote control is supported or not.
|
|
|
|
* @param {boolean} isSupported
|
|
|
|
*/
|
|
|
|
setRemoteControlSupport(isSupported = false) {
|
|
|
|
if (this._supportsRemoteControl === isSupported) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this._supportsRemoteControl = isSupported;
|
|
|
|
this.updateRemoteVideoMenu();
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Requests permissions for remote control session.
|
|
|
|
*/
|
|
|
|
_requestRemoteControlPermissions() {
|
|
|
|
APP.remoteControl.controller.requestPermissions(this.id, this.VideoLayout.getLargeVideoWrapper())
|
|
|
|
.then(result => {
|
|
|
|
if (result === null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.updateRemoteVideoMenu();
|
|
|
|
APP.UI.messageHandler.notify(
|
|
|
|
'dialog.remoteControlTitle',
|
|
|
|
result === false ? 'dialog.remoteControlDeniedMessage' : 'dialog.remoteControlAllowedMessage',
|
|
|
|
{ user: this.user.getDisplayName() || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME }
|
|
|
|
);
|
|
|
|
if (result === true) {
|
|
|
|
// the remote control permissions has been granted
|
|
|
|
// pin the controlled participant
|
|
|
|
const pinnedParticipant = getPinnedParticipant(APP.store.getState()) || {};
|
|
|
|
const pinnedId = pinnedParticipant.id;
|
|
|
|
|
|
|
|
if (pinnedId !== this.id) {
|
|
|
|
APP.store.dispatch(pinParticipant(this.id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, error => {
|
|
|
|
logger.error(error);
|
|
|
|
this.updateRemoteVideoMenu();
|
|
|
|
APP.UI.messageHandler.notify(
|
|
|
|
'dialog.remoteControlTitle',
|
|
|
|
'dialog.remoteControlErrorMessage',
|
|
|
|
{ user: this.user.getDisplayName() || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME }
|
|
|
|
);
|
|
|
|
});
|
|
|
|
this.updateRemoteVideoMenu();
|
2017-05-25 13:48:06 +00:00
|
|
|
}
|
2016-09-22 21:21:01 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Stops remote control session.
|
|
|
|
*/
|
|
|
|
_stopRemoteControl() {
|
|
|
|
// send message about stopping
|
|
|
|
APP.remoteControl.controller.stop();
|
|
|
|
this.updateRemoteVideoMenu();
|
2017-10-12 23:02:29 +00:00
|
|
|
}
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Change the remote participant's volume level.
|
|
|
|
*
|
|
|
|
* @param {int} newVal - The value to set the slider to.
|
|
|
|
*/
|
|
|
|
_setAudioVolume(newVal) {
|
|
|
|
if (this._audioStreamElement) {
|
|
|
|
this._audioStreamElement.volume = newVal;
|
|
|
|
}
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Updates the remote video menu.
|
|
|
|
*
|
|
|
|
* @param isMuted the new muted state to update to
|
|
|
|
*/
|
|
|
|
updateRemoteVideoMenu(isMuted) {
|
|
|
|
if (typeof isMuted !== 'undefined') {
|
|
|
|
this.isAudioMuted = isMuted;
|
|
|
|
}
|
|
|
|
this._generatePopupContent();
|
|
|
|
}
|
2016-02-23 22:47:55 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
* @override
|
|
|
|
*/
|
|
|
|
setVideoMutedView(isMuted) {
|
|
|
|
super.setVideoMutedView(isMuted);
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// Update 'mutedWhileDisconnected' flag
|
|
|
|
this._figureOutMutedWhileDisconnected();
|
2016-09-22 20:57:43 +00:00
|
|
|
}
|
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Figures out the value of {@link #mutedWhileDisconnected} flag by taking into
|
|
|
|
* account remote participant's network connectivity and video muted status.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_figureOutMutedWhileDisconnected() {
|
|
|
|
const isActive = this.isConnectionActive();
|
2019-05-28 20:30:27 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (!isActive && this.isVideoMuted) {
|
|
|
|
this.mutedWhileDisconnected = true;
|
|
|
|
} else if (isActive && !this.isVideoMuted) {
|
|
|
|
this.mutedWhileDisconnected = false;
|
|
|
|
}
|
2019-05-28 20:30:27 +00:00
|
|
|
}
|
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes the remote stream element corresponding to the given stream and
|
|
|
|
* parent container.
|
|
|
|
*
|
|
|
|
* @param stream the MediaStream
|
|
|
|
* @param isVideo <tt>true</tt> if given <tt>stream</tt> is a video one.
|
|
|
|
*/
|
|
|
|
removeRemoteStreamElement(stream) {
|
|
|
|
if (!this.container) {
|
|
|
|
return false;
|
|
|
|
}
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
const isVideo = stream.isVideoTrack();
|
|
|
|
const elementID = SmallVideo.getStreamElementID(stream);
|
|
|
|
const select = $(`#${elementID}`);
|
2016-09-16 20:51:19 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
select.remove();
|
|
|
|
if (isVideo) {
|
|
|
|
this.wasVideoPlayed = false;
|
|
|
|
}
|
2016-09-19 20:59:56 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
logger.info(`${isVideo ? 'Video' : 'Audio'} removed ${this.id}`, select);
|
2016-09-22 21:21:01 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (stream === this.videoStream) {
|
|
|
|
this.videoStream = null;
|
|
|
|
}
|
2016-09-22 21:21:01 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
this.updateView();
|
|
|
|
}
|
2016-09-16 20:51:19 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the remote user associated with this <tt>RemoteVideo</tt>
|
|
|
|
* has connectivity issues.
|
|
|
|
*
|
|
|
|
* @return {boolean} <tt>true</tt> if the user's connection is fine or
|
|
|
|
* <tt>false</tt> otherwise.
|
|
|
|
*/
|
|
|
|
isConnectionActive() {
|
|
|
|
return this.user.getConnectionStatus() === JitsiParticipantConnectionStatus.ACTIVE;
|
|
|
|
}
|
2017-03-21 17:14:13 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* The remote video is considered "playable" once the stream has started
|
|
|
|
* according to the {@link #hasVideoStarted} result.
|
|
|
|
* It will be allowed to display video also in
|
|
|
|
* {@link JitsiParticipantConnectionStatus.INTERRUPTED} if the video was ever
|
|
|
|
* played and was not muted while not in ACTIVE state. This basically means
|
|
|
|
* that there is stalled video image cached that could be displayed. It's used
|
|
|
|
* to show "grey video image" in user's thumbnail when there are connectivity
|
|
|
|
* issues.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @override
|
|
|
|
*/
|
|
|
|
isVideoPlayable() {
|
|
|
|
const connectionState = APP.conference.getParticipantConnectionStatus(this.id);
|
2016-09-16 20:51:19 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
return super.isVideoPlayable()
|
|
|
|
&& this.hasVideoStarted()
|
|
|
|
&& (connectionState === JitsiParticipantConnectionStatus.ACTIVE
|
|
|
|
|| (connectionState === JitsiParticipantConnectionStatus.INTERRUPTED && !this.mutedWhileDisconnected));
|
|
|
|
}
|
2016-09-19 19:18:52 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
updateView() {
|
|
|
|
this.$container.toggleClass('audio-only', APP.conference.isAudioOnly());
|
|
|
|
this.updateConnectionStatusIndicator();
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// This must be called after 'updateConnectionStatusIndicator' because it
|
|
|
|
// affects the display mode by modifying 'mutedWhileDisconnected' flag
|
|
|
|
super.updateView();
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Updates the UI to reflect user's connectivity status.
|
|
|
|
*/
|
|
|
|
updateConnectionStatusIndicator() {
|
|
|
|
const connectionStatus = this.user.getConnectionStatus();
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
logger.debug(`${this.id} thumbnail connection status: ${connectionStatus}`);
|
2017-06-29 18:21:03 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// FIXME rename 'mutedWhileDisconnected' to 'mutedWhileNotRendering'
|
|
|
|
// Update 'mutedWhileDisconnected' flag
|
|
|
|
this._figureOutMutedWhileDisconnected();
|
|
|
|
this.updateConnectionStatus(connectionStatus);
|
2015-07-15 12:01:36 +00:00
|
|
|
}
|
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes RemoteVideo from the page.
|
|
|
|
*/
|
|
|
|
remove() {
|
|
|
|
super.remove();
|
|
|
|
this.removePresenceLabel();
|
|
|
|
this.removeRemoteVideoMenu();
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {*} streamElement
|
|
|
|
* @param {*} stream
|
|
|
|
*/
|
|
|
|
waitForPlayback(streamElement, stream) {
|
|
|
|
const webRtcStream = stream.getOriginalStream();
|
|
|
|
const isVideo = stream.isVideoTrack();
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (!isVideo || webRtcStream.id === 'mixedmslabel') {
|
|
|
|
return;
|
|
|
|
}
|
2015-07-15 12:01:36 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
streamElement.onplaying = () => {
|
|
|
|
this.wasVideoPlayed = true;
|
|
|
|
this.VideoLayout.remoteVideoActive(streamElement, this.id);
|
|
|
|
streamElement.onplaying = null;
|
2016-02-01 22:08:15 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// Refresh to show the video
|
|
|
|
this.updateView();
|
|
|
|
};
|
|
|
|
}
|
2019-09-17 20:26:34 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Checks whether the video stream has started for this RemoteVideo instance.
|
|
|
|
*
|
|
|
|
* @returns {boolean} true if this RemoteVideo has a video stream for which
|
|
|
|
* the playback has been started.
|
|
|
|
*/
|
|
|
|
hasVideoStarted() {
|
|
|
|
return this.wasVideoPlayed;
|
2015-12-14 12:26:50 +00:00
|
|
|
}
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {*} stream
|
|
|
|
*/
|
|
|
|
addRemoteStreamElement(stream) {
|
|
|
|
if (!this.container) {
|
|
|
|
logger.debug('Not attaching remote stream due to no container');
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
const isVideo = stream.isVideoTrack();
|
2016-07-21 03:13:26 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
isVideo ? this.videoStream = stream : this.audioStream = stream;
|
2019-09-17 20:26:34 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (isVideo) {
|
|
|
|
this.setVideoType(stream.videoType);
|
|
|
|
}
|
2016-01-22 22:37:33 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (!stream.getOriginalStream()) {
|
|
|
|
logger.debug('Remote video stream has no original stream');
|
2016-01-22 22:37:33 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-08-17 16:43:22 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
const streamElement = SmallVideo.createStreamElement(stream);
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// Put new stream element always in front
|
|
|
|
UIUtils.prependChild(this.container, streamElement);
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
$(streamElement).hide();
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
this.waitForPlayback(streamElement, stream);
|
|
|
|
stream.attach(streamElement);
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (!isVideo) {
|
|
|
|
this._audioStreamElement = streamElement;
|
2017-08-14 15:02:58 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
// If the remote video menu was created before the audio stream was
|
|
|
|
// attached we need to update the menu in order to show the volume
|
|
|
|
// slider.
|
|
|
|
this.updateRemoteVideoMenu();
|
|
|
|
}
|
2015-06-23 08:00:46 +00:00
|
|
|
}
|
2015-07-20 17:32:04 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Triggers re-rendering of the display name using current instance state.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
updateDisplayName() {
|
|
|
|
if (!this.container) {
|
|
|
|
logger.warn(`Unable to set displayName - ${this.videoSpanId} does not exist`);
|
2017-07-31 23:33:22 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-07-31 23:33:22 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
this._renderDisplayName({
|
|
|
|
elementID: `${this.videoSpanId}_name`,
|
|
|
|
participantID: this.id
|
|
|
|
});
|
2017-07-31 23:33:22 +00:00
|
|
|
}
|
2016-09-15 02:20:54 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Removes remote video menu element from video element identified by
|
|
|
|
* given <tt>videoElementId</tt>.
|
|
|
|
*
|
|
|
|
* @param videoElementId the id of local or remote video element.
|
|
|
|
*/
|
|
|
|
removeRemoteVideoMenu() {
|
|
|
|
const menuSpan = this.$container.find('.remotevideomenu');
|
2017-08-14 15:02:58 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (menuSpan.length) {
|
|
|
|
ReactDOM.unmountComponentAtNode(menuSpan.get(0));
|
|
|
|
menuSpan.remove();
|
|
|
|
}
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Mounts the {@code PresenceLabel} for displaying the participant's current
|
|
|
|
* presence status.
|
|
|
|
*
|
|
|
|
* @return {void}
|
|
|
|
*/
|
|
|
|
addPresenceLabel() {
|
|
|
|
const presenceLabelContainer = this.container.querySelector('.presence-label-container');
|
|
|
|
|
|
|
|
if (presenceLabelContainer) {
|
|
|
|
ReactDOM.render(
|
|
|
|
<Provider store = { APP.store }>
|
|
|
|
<I18nextProvider i18n = { i18next }>
|
|
|
|
<PresenceLabel
|
|
|
|
participantID = { this.id }
|
|
|
|
className = 'presence-label' />
|
|
|
|
</I18nextProvider>
|
|
|
|
</Provider>,
|
|
|
|
presenceLabelContainer);
|
|
|
|
}
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
/**
|
|
|
|
* Unmounts the {@code PresenceLabel} component.
|
|
|
|
*
|
|
|
|
* @return {void}
|
|
|
|
*/
|
|
|
|
removePresenceLabel() {
|
|
|
|
const presenceLabelContainer = this.container.querySelector('.presence-label-container');
|
2015-06-23 08:00:46 +00:00
|
|
|
|
2019-12-16 14:15:02 +00:00
|
|
|
if (presenceLabelContainer) {
|
|
|
|
ReactDOM.unmountComponentAtNode(presenceLabelContainer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|