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 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. const avatarSize = height / 2;
  36. if (thumbs.localThumb) {
  37. thumbs.localThumb.css({
  38. 'padding-top': '',
  39. height: `${height}px`,
  40. 'min-height': `${height}px`,
  41. 'min-width': `${width}px`,
  42. width: `${width}px`
  43. });
  44. }
  45. if (thumbs.remoteThumbs) {
  46. thumbs.remoteThumbs.css({
  47. 'padding-top': '',
  48. height: `${height}px`,
  49. 'min-height': `${height}px`,
  50. 'min-width': `${width}px`,
  51. width: `${width}px`
  52. });
  53. }
  54. // diff
  55. // $('.avatar-container').css({
  56. thumbs.remlocThumbs.find('.avatar-container').css({
  57. height: `${avatarSize}px`,
  58. width: `${avatarSize}px`
  59. });
  60. },
  61. /**
  62. * Resizes thumbnails for horizontal view.
  63. *
  64. * @param {Object} dimensions - The new dimensions of the thumbnails.
  65. * @param {boolean} forceUpdate
  66. * @returns {void}
  67. */
  68. resizeThumbnailsForHorizontalView({ local = {}, remote = {} }, forceUpdate = false) {
  69. const thumbs = this._getThumbs(!forceUpdate);
  70. if (thumbs.localThumb) {
  71. const { height, width } = local;
  72. const avatarSize = height / 2;
  73. thumbs.localThumb.css({
  74. height: `${height}px`,
  75. 'min-height': `${height}px`,
  76. 'min-width': `${width}px`,
  77. width: `${width}px`
  78. });
  79. $('#localVideoContainer > .avatar-container').css({
  80. height: `${avatarSize}px`,
  81. width: `${avatarSize}px`
  82. });
  83. }
  84. if (thumbs.remoteThumbs) {
  85. const { height, width } = remote;
  86. const avatarSize = height / 2;
  87. thumbs.remoteThumbs.css({
  88. height: `${height}px`,
  89. 'min-height': `${height}px`,
  90. 'min-width': `${width}px`,
  91. width: `${width}px`
  92. });
  93. $('#filmstripRemoteVideosContainer > span > .avatar-container').css({
  94. height: `${avatarSize}px`,
  95. width: `${avatarSize}px`
  96. });
  97. }
  98. },
  99. /**
  100. * Resizes thumbnails for vertical view.
  101. *
  102. * @returns {void}
  103. */
  104. resizeThumbnailsForVerticalView() {
  105. const thumbs = this._getThumbs(true);
  106. if (thumbs.localThumb) {
  107. const heightToWidthPercent = 100 / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
  108. thumbs.localThumb.css({
  109. 'padding-top': `${heightToWidthPercent}%`,
  110. width: '',
  111. height: '',
  112. 'min-width': '',
  113. 'min-height': ''
  114. });
  115. $('#localVideoContainer > .avatar-container').css({
  116. height: '50%',
  117. width: `${heightToWidthPercent / 2}%`
  118. });
  119. }
  120. if (thumbs.remoteThumbs) {
  121. const heightToWidthPercent = 100 / interfaceConfig.REMOTE_THUMBNAIL_RATIO;
  122. thumbs.remoteThumbs.css({
  123. 'padding-top': `${heightToWidthPercent}%`,
  124. width: '',
  125. height: '',
  126. 'min-width': '',
  127. 'min-height': ''
  128. });
  129. $('#filmstripRemoteVideosContainer > span > .avatar-container').css({
  130. height: '50%',
  131. width: `${heightToWidthPercent / 2}%`
  132. });
  133. }
  134. },
  135. /**
  136. * Returns thumbnails of the filmstrip
  137. * @param onlyVisible
  138. * @returns {object} thumbnails
  139. */
  140. _getThumbs_orig(onlyVisible = false) {
  141. let selector = 'span';
  142. if (onlyVisible) {
  143. selector += ':visible';
  144. }
  145. const localThumb = $('#localVideoContainer');
  146. const remoteThumbs = $('#filmstripRemoteVideosContainer').children(selector);
  147. // Exclude the local video container if it has been hidden.
  148. if (localThumb.hasClass('hidden')) {
  149. return { remoteThumbs };
  150. }
  151. return { remoteThumbs,
  152. localThumb };
  153. },
  154. _getThumbs_works(onlyVisible = false) {
  155. // let selector = 'span';
  156. // console.log("crnr flm getThumbs",!!(window.log_tb))
  157. // console.log("crnr flm getThumbs",this,this.filmstripRemoteVideos)
  158. // window.log_tb ? log_tb(new Error(),"getThumbs") : 0
  159. // console.trace("getThumbs_tb")
  160. let selector = '.remote_vid,.pseudo_vid';
  161. selector = window.glob_sel || selector;
  162. let filter = '';
  163. if (onlyVisible) {
  164. filter += ':visible';
  165. }
  166. const localThumb = $('#localVideoContainer');
  167. // const remoteThumbs = this.filmstripRemoteVideos.children(selector);
  168. // const remoteThumbs = this.filmstripRemoteVideos.find(selector);
  169. const filmstripRemoteVideos = $('#filmstripRemoteVideosContainer')
  170. // const remoteThumbs = filter ? filmstripRemoteVideos.find(selector).filter(filter) : filmstripRemoteVideos.find(selector);
  171. // const remoteThumbs = filter ? filmstripRemoteVideos.find(selector).children(filter) : filmstripRemoteVideos.children(selector);
  172. const remoteThumbs = filter ? filmstripRemoteVideos.children(selector).filter(filter) : filmstripRemoteVideos.children(selector);
  173. // Exclude the local video container if it has been hidden.
  174. if (localThumb.hasClass('hidden')) {
  175. return { remoteThumbs };
  176. }
  177. return { remoteThumbs,
  178. localThumb };
  179. },
  180. // _getThumbs_buggy(onlyVisible = false) {
  181. _getThumbs(onlyVisible = false) {
  182. let selector = '.remote_vid,.pseudo_vid';
  183. selector = window.glob_sel || selector;
  184. let filter = '';
  185. if (onlyVisible) {
  186. filter += ':visible';
  187. }
  188. const filmstripRemoteVideos = $('#filmstripRemoteVideosContainer')
  189. const localThumb = $("#filmstripRemoteVideosContainer > #localVideoTileViewContainer,#filmstripLocalVideoThumbnail").children('#localVideoContainer');
  190. const remoteThumbs = filter ? filmstripRemoteVideos.children(selector).filter(filter) : filmstripRemoteVideos.children(selector);
  191. // Exclude the local video container if it has been hidden.
  192. if (localThumb.hasClass('hidden') || ! localThumb.length ) {
  193. return { remoteThumbs,remlocThumbs:remoteThumbs };
  194. }
  195. return { remoteThumbs,
  196. localThumb,remlocThumbs:remoteThumbs.add(localThumb) };
  197. },
  198. };
  199. export default Filmstrip;