2018-09-11 18:09:07 +00:00
|
|
|
/* global $ */
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2017-07-03 19:14:30 +00:00
|
|
|
import SmallVideo from '../videolayout/SmallVideo';
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
2017-07-03 19:14:30 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2018-05-22 17:13:51 +00:00
|
|
|
export default function SharedVideoThumb(participant, videoType, VideoLayout) {
|
|
|
|
this.id = participant.id;
|
2017-07-03 19:14:30 +00:00
|
|
|
|
2018-05-22 17:13:51 +00:00
|
|
|
this.url = participant.id;
|
2017-07-03 19:14:30 +00:00
|
|
|
this.setVideoType(videoType);
|
2017-10-12 23:02:29 +00:00
|
|
|
this.videoSpanId = 'sharedVideoContainer';
|
2017-07-03 19:14:30 +00:00
|
|
|
this.container = this.createContainer(this.videoSpanId);
|
|
|
|
this.$container = $(this.container);
|
2018-11-30 22:13:39 +00:00
|
|
|
|
2017-07-03 19:14:30 +00:00
|
|
|
this.bindHoverHandler();
|
|
|
|
SmallVideo.call(this, VideoLayout);
|
|
|
|
this.isVideoMuted = true;
|
2019-03-26 16:34:02 +00:00
|
|
|
this.updateDisplayName();
|
2018-11-30 22:13:39 +00:00
|
|
|
|
|
|
|
this.container.onclick = this._onContainerClick;
|
2017-07-03 19:14:30 +00:00
|
|
|
}
|
|
|
|
SharedVideoThumb.prototype = Object.create(SmallVideo.prototype);
|
|
|
|
SharedVideoThumb.prototype.constructor = SharedVideoThumb;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* hide display name
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
// eslint-disable-next-line no-empty-function
|
|
|
|
SharedVideoThumb.prototype.setDeviceAvailabilityIcons = function() {};
|
2017-07-03 19:14:30 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
// eslint-disable-next-line no-empty-function
|
2019-06-26 14:08:23 +00:00
|
|
|
SharedVideoThumb.prototype.initializeAvatar = function() {};
|
2017-07-03 19:14:30 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
SharedVideoThumb.prototype.createContainer = function(spanId) {
|
|
|
|
const container = document.createElement('span');
|
2017-07-03 19:14:30 +00:00
|
|
|
|
|
|
|
container.id = spanId;
|
|
|
|
container.className = 'videocontainer';
|
|
|
|
|
|
|
|
// add the avatar
|
2017-10-12 23:02:29 +00:00
|
|
|
const avatar = document.createElement('img');
|
|
|
|
|
2017-07-03 19:14:30 +00:00
|
|
|
avatar.className = 'sharedVideoAvatar';
|
2017-10-12 23:02:29 +00:00
|
|
|
avatar.src = `https://img.youtube.com/vi/${this.url}/0.jpg`;
|
2017-07-03 19:14:30 +00:00
|
|
|
container.appendChild(avatar);
|
|
|
|
|
|
|
|
const displayNameContainer = document.createElement('div');
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2017-07-03 19:14:30 +00:00
|
|
|
displayNameContainer.className = 'displayNameContainer';
|
|
|
|
container.appendChild(displayNameContainer);
|
|
|
|
|
2018-07-26 17:51:15 +00:00
|
|
|
const remoteVideosContainer
|
|
|
|
= document.getElementById('filmstripRemoteVideosContainer');
|
|
|
|
const localVideoContainer
|
|
|
|
= document.getElementById('localVideoTileViewContainer');
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2018-07-26 17:51:15 +00:00
|
|
|
remoteVideosContainer.insertBefore(container, localVideoContainer);
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2018-07-26 17:51:15 +00:00
|
|
|
return container;
|
2017-07-03 19:14:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2019-03-26 16:34:02 +00:00
|
|
|
* Triggers re-rendering of the display name using current instance state.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
2017-07-03 19:14:30 +00:00
|
|
|
*/
|
2019-03-26 16:34:02 +00:00
|
|
|
SharedVideoThumb.prototype.updateDisplayName = function() {
|
2017-07-03 19:14:30 +00:00
|
|
|
if (!this.container) {
|
2017-10-12 23:02:29 +00:00
|
|
|
logger.warn(`Unable to set displayName - ${this.videoSpanId
|
|
|
|
} does not exist`);
|
|
|
|
|
2017-07-03 19:14:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-03-26 16:34:02 +00:00
|
|
|
this._renderDisplayName({
|
2017-07-03 19:14:30 +00:00
|
|
|
elementID: `${this.videoSpanId}_name`,
|
|
|
|
participantID: this.id
|
|
|
|
});
|
|
|
|
};
|