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.

Filmstrip.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* global $, APP, interfaceConfig */
  2. import { getVerticalFilmstripVisibleAreaWidth, isFilmstripVisible } from '../../../react/features/filmstrip';
  3. const Filmstrip = {
  4. /**
  5. * Returns the height of filmstrip
  6. * @returns {number} height
  7. */
  8. getFilmstripHeight() {
  9. // FIXME Make it more clear the getFilmstripHeight check is used in
  10. // horizontal film strip mode for calculating how tall large video
  11. // display should be.
  12. if (isFilmstripVisible(APP.store) && !interfaceConfig.VERTICAL_FILMSTRIP) {
  13. return $('.filmstrip').outerHeight();
  14. }
  15. return 0;
  16. },
  17. /**
  18. * Returns the width of the vertical filmstip if the filmstrip is visible and 0 otherwise.
  19. *
  20. * @returns {number} - The width of the vertical filmstip if the filmstrip is visible and 0 otherwise.
  21. */
  22. getVerticalFilmstripWidth() {
  23. return isFilmstripVisible(APP.store) ? getVerticalFilmstripVisibleAreaWidth() : 0;
  24. },
  25. /**
  26. * Resizes thumbnails for tile view.
  27. *
  28. * @param {number} width - The new width of the thumbnails.
  29. * @param {number} height - The new height of the thumbnails.
  30. * @param {boolean} forceUpdate
  31. * @returns {void}
  32. */
  33. resizeThumbnailsForTileView(width, height, forceUpdate = false) {
  34. const thumbs = this._getThumbs(!forceUpdate);
  35. if (thumbs.localThumb) {
  36. thumbs.localThumb.css({
  37. 'padding-top': '',
  38. height: `${height}px`,
  39. 'min-height': `${height}px`,
  40. 'min-width': `${width}px`,
  41. width: `${width}px`
  42. });
  43. }
  44. if (thumbs.remoteThumbs) {
  45. thumbs.remoteThumbs.css({
  46. 'padding-top': '',
  47. height: `${height}px`,
  48. 'min-height': `${height}px`,
  49. 'min-width': `${width}px`,
  50. width: `${width}px`
  51. });
  52. }
  53. },
  54. /**
  55. * Resizes thumbnails for horizontal view.
  56. *
  57. * @param {Object} dimensions - The new dimensions of the thumbnails.
  58. * @param {boolean} forceUpdate
  59. * @returns {void}
  60. */
  61. resizeThumbnailsForHorizontalView({ local = {}, remote = {} }, forceUpdate = false) {
  62. const thumbs = this._getThumbs(!forceUpdate);
  63. if (thumbs.localThumb) {
  64. const { height, width } = local;
  65. thumbs.localThumb.css({
  66. height: `${height}px`,
  67. 'min-height': `${height}px`,
  68. 'min-width': `${width}px`,
  69. width: `${width}px`
  70. });
  71. }
  72. if (thumbs.remoteThumbs) {
  73. const { height, width } = remote;
  74. thumbs.remoteThumbs.css({
  75. height: `${height}px`,
  76. 'min-height': `${height}px`,
  77. 'min-width': `${width}px`,
  78. width: `${width}px`
  79. });
  80. }
  81. },
  82. /**
  83. * Resizes thumbnails for vertical view.
  84. *
  85. * @returns {void}
  86. */
  87. resizeThumbnailsForVerticalView() {
  88. const thumbs = this._getThumbs(true);
  89. if (thumbs.localThumb) {
  90. const heightToWidthPercent = 100 / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
  91. thumbs.localThumb.css({
  92. 'padding-top': `${heightToWidthPercent}%`,
  93. width: '',
  94. height: '',
  95. 'min-width': '',
  96. 'min-height': ''
  97. });
  98. }
  99. if (thumbs.remoteThumbs) {
  100. const heightToWidthPercent = 100 / interfaceConfig.REMOTE_THUMBNAIL_RATIO;
  101. thumbs.remoteThumbs.css({
  102. 'padding-top': `${heightToWidthPercent}%`,
  103. width: '',
  104. height: '',
  105. 'min-width': '',
  106. 'min-height': ''
  107. });
  108. }
  109. },
  110. /**
  111. * Returns thumbnails of the filmstrip
  112. * @param onlyVisible
  113. * @returns {object} thumbnails
  114. */
  115. _getThumbs(onlyVisible = false) {
  116. let selector = 'span';
  117. if (onlyVisible) {
  118. selector += ':visible';
  119. }
  120. const localThumb = $('#localVideoContainer');
  121. const remoteThumbs = $('#filmstripRemoteVideosContainer').children(selector);
  122. // Exclude the local video container if it has been hidden.
  123. if (localThumb.hasClass('hidden')) {
  124. return { remoteThumbs };
  125. }
  126. return { remoteThumbs,
  127. localThumb };
  128. }
  129. };
  130. export default Filmstrip;