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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* global $ */
  2. import SmallVideo from '../videolayout/SmallVideo';
  3. const logger = require("jitsi-meet-logger").getLogger(__filename);
  4. export default function SharedVideoThumb (url, videoType, VideoLayout)
  5. {
  6. this.id = url;
  7. this.url = url;
  8. this.setVideoType(videoType);
  9. this.videoSpanId = "sharedVideoContainer";
  10. this.container = this.createContainer(this.videoSpanId);
  11. this.$container = $(this.container);
  12. this.container.onclick = this.videoClick.bind(this);
  13. this.bindHoverHandler();
  14. SmallVideo.call(this, VideoLayout);
  15. this.isVideoMuted = true;
  16. }
  17. SharedVideoThumb.prototype = Object.create(SmallVideo.prototype);
  18. SharedVideoThumb.prototype.constructor = SharedVideoThumb;
  19. /**
  20. * hide display name
  21. */
  22. SharedVideoThumb.prototype.setDeviceAvailabilityIcons = function () {};
  23. SharedVideoThumb.prototype.avatarChanged = function () {};
  24. SharedVideoThumb.prototype.createContainer = function (spanId) {
  25. var container = document.createElement('span');
  26. container.id = spanId;
  27. container.className = 'videocontainer';
  28. // add the avatar
  29. var avatar = document.createElement('img');
  30. avatar.className = 'sharedVideoAvatar';
  31. avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg";
  32. container.appendChild(avatar);
  33. const displayNameContainer = document.createElement('div');
  34. displayNameContainer.className = 'displayNameContainer';
  35. container.appendChild(displayNameContainer);
  36. var remotes = document.getElementById('filmstripRemoteVideosContainer');
  37. return remotes.appendChild(container);
  38. };
  39. /**
  40. * The thumb click handler.
  41. */
  42. SharedVideoThumb.prototype.videoClick = function () {
  43. this.VideoLayout.handleVideoThumbClicked(this.url);
  44. };
  45. /**
  46. * Removes RemoteVideo from the page.
  47. */
  48. SharedVideoThumb.prototype.remove = function () {
  49. logger.log("Remove shared video thumb", this.id);
  50. // Make sure that the large video is updated if are removing its
  51. // corresponding small video.
  52. this.VideoLayout.updateAfterThumbRemoved(this.id);
  53. // Remove whole container
  54. if (this.container.parentNode) {
  55. this.container.parentNode.removeChild(this.container);
  56. }
  57. };
  58. /**
  59. * Sets the display name for the thumb.
  60. */
  61. SharedVideoThumb.prototype.setDisplayName = function(displayName) {
  62. if (!this.container) {
  63. logger.warn( "Unable to set displayName - " + this.videoSpanId +
  64. " does not exist");
  65. return;
  66. }
  67. this.updateDisplayName({
  68. displayName: displayName || '',
  69. elementID: `${this.videoSpanId}_name`,
  70. participantID: this.id
  71. });
  72. };