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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. this.container.ondblclick = this._onContainerDoubleClick;
  20. }
  21. SharedVideoThumb.prototype = Object.create(SmallVideo.prototype);
  22. SharedVideoThumb.prototype.constructor = SharedVideoThumb;
  23. /**
  24. * hide display name
  25. */
  26. // eslint-disable-next-line no-empty-function
  27. SharedVideoThumb.prototype.setDeviceAvailabilityIcons = function() {};
  28. // eslint-disable-next-line no-empty-function
  29. SharedVideoThumb.prototype.avatarChanged = function() {};
  30. SharedVideoThumb.prototype.createContainer = function(spanId) {
  31. const container = document.createElement('span');
  32. container.id = spanId;
  33. container.className = 'videocontainer';
  34. // add the avatar
  35. const avatar = document.createElement('img');
  36. avatar.className = 'sharedVideoAvatar';
  37. avatar.src = `https://img.youtube.com/vi/${this.url}/0.jpg`;
  38. container.appendChild(avatar);
  39. const displayNameContainer = document.createElement('div');
  40. displayNameContainer.className = 'displayNameContainer';
  41. container.appendChild(displayNameContainer);
  42. const remoteVideosContainer
  43. = document.getElementById('filmstripRemoteVideosContainer');
  44. const localVideoContainer
  45. = document.getElementById('localVideoTileViewContainer');
  46. remoteVideosContainer.insertBefore(container, localVideoContainer);
  47. return container;
  48. };
  49. /**
  50. * Triggers re-rendering of the display name using current instance state.
  51. *
  52. * @returns {void}
  53. */
  54. SharedVideoThumb.prototype.updateDisplayName = function() {
  55. if (!this.container) {
  56. logger.warn(`Unable to set displayName - ${this.videoSpanId
  57. } does not exist`);
  58. return;
  59. }
  60. this._renderDisplayName({
  61. elementID: `${this.videoSpanId}_name`,
  62. participantID: this.id
  63. });
  64. };