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.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.setVideoType(videoType);
  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. }