您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SharedVideoThumb.js 2.4KB

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.setDisplayName(participant.name);
  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. * Sets the display name for the thumb.
  51. */
  52. SharedVideoThumb.prototype.setDisplayName = function(displayName) {
  53. if (!this.container) {
  54. logger.warn(`Unable to set displayName - ${this.videoSpanId
  55. } does not exist`);
  56. return;
  57. }
  58. this.updateDisplayName({
  59. displayName: displayName || '',
  60. elementID: `${this.videoSpanId}_name`,
  61. participantID: this.id
  62. });
  63. };