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

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