You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SharedVideoThumb.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* global $ */
  2. import SmallVideo from '../videolayout/SmallVideo';
  3. const logger = require('jitsi-meet-logger').getLogger(__filename);
  4. /**
  5. *
  6. */
  7. export default function SharedVideoThumb(participant, videoType, VideoLayout) {
  8. this.id = participant.id;
  9. this.url = participant.id;
  10. this.setVideoType(videoType);
  11. this.videoSpanId = 'sharedVideoContainer';
  12. this.container = this.createContainer(this.videoSpanId);
  13. this.$container = $(this.container);
  14. this.bindHoverHandler();
  15. SmallVideo.call(this, VideoLayout);
  16. this.isVideoMuted = true;
  17. this.updateDisplayName();
  18. this.container.onclick = this._onContainerClick;
  19. }
  20. SharedVideoThumb.prototype = Object.create(SmallVideo.prototype);
  21. SharedVideoThumb.prototype.constructor = SharedVideoThumb;
  22. /**
  23. * hide display name
  24. */
  25. // eslint-disable-next-line no-empty-function
  26. SharedVideoThumb.prototype.setDeviceAvailabilityIcons = function() {};
  27. // eslint-disable-next-line no-empty-function
  28. SharedVideoThumb.prototype.initializeAvatar = function() {};
  29. SharedVideoThumb.prototype.createContainer = function(spanId) {
  30. const container = document.createElement('span');
  31. container.id = spanId;
  32. container.className = 'videocontainer';
  33. // add the avatar
  34. const avatar = document.createElement('img');
  35. avatar.className = 'sharedVideoAvatar';
  36. avatar.src = `https://img.youtube.com/vi/${this.url}/0.jpg`;
  37. container.appendChild(avatar);
  38. const displayNameContainer = document.createElement('div');
  39. displayNameContainer.className = 'displayNameContainer';
  40. container.appendChild(displayNameContainer);
  41. const remoteVideosContainer
  42. = document.getElementById('filmstripRemoteVideosContainer');
  43. const localVideoContainer
  44. = document.getElementById('localVideoTileViewContainer');
  45. remoteVideosContainer.insertBefore(container, localVideoContainer);
  46. return container;
  47. };
  48. /**
  49. * Triggers re-rendering of the display name using current instance state.
  50. *
  51. * @returns {void}
  52. */
  53. SharedVideoThumb.prototype.updateDisplayName = function() {
  54. if (!this.container) {
  55. logger.warn(`Unable to set displayName - ${this.videoSpanId
  56. } does not exist`);
  57. return;
  58. }
  59. this._renderDisplayName({
  60. elementID: `${this.videoSpanId}_name`,
  61. participantID: this.id
  62. });
  63. };