2017-07-03 19:14:30 +00:00
|
|
|
/* global $ */
|
|
|
|
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);
|
|
|
|
this.container.onclick = this.videoClick.bind(this);
|
|
|
|
this.bindHoverHandler();
|
|
|
|
SmallVideo.call(this, VideoLayout);
|
|
|
|
this.isVideoMuted = true;
|
2018-05-22 17:13:51 +00:00
|
|
|
this.setDisplayName(participant.name);
|
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
|
|
|
|
SharedVideoThumb.prototype.avatarChanged = 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);
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const remotes = document.getElementById('filmstripRemoteVideosContainer');
|
|
|
|
|
|
|
|
|
2017-07-03 19:14:30 +00:00
|
|
|
return remotes.appendChild(container);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The thumb click handler.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SharedVideoThumb.prototype.videoClick = function() {
|
2018-05-18 19:59:07 +00:00
|
|
|
this._togglePin();
|
2017-07-03 19:14:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes RemoteVideo from the page.
|
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
SharedVideoThumb.prototype.remove = function() {
|
|
|
|
logger.log('Remove shared video thumb', this.id);
|
2017-07-03 19:14:30 +00:00
|
|
|
|
|
|
|
// Remove whole container
|
|
|
|
if (this.container.parentNode) {
|
|
|
|
this.container.parentNode.removeChild(this.container);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the display name for the thumb.
|
|
|
|
*/
|
|
|
|
SharedVideoThumb.prototype.setDisplayName = function(displayName) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.updateDisplayName({
|
|
|
|
displayName: displayName || '',
|
|
|
|
elementID: `${this.videoSpanId}_name`,
|
|
|
|
participantID: this.id
|
|
|
|
});
|
|
|
|
};
|