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

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