2017-10-10 23:43:22 +00:00
|
|
|
/* global $, APP, interfaceConfig */
|
2016-02-24 21:05:24 +00:00
|
|
|
|
2020-02-10 15:27:43 +00:00
|
|
|
import { getVerticalFilmstripVisibleAreaWidth, isFilmstripVisible } from '../../../react/features/filmstrip';
|
2016-02-24 21:05:24 +00:00
|
|
|
|
2017-04-10 17:59:44 +00:00
|
|
|
const Filmstrip = {
|
2016-11-03 13:12:45 +00:00
|
|
|
/**
|
|
|
|
* Returns the height of filmstrip
|
|
|
|
* @returns {number} height
|
|
|
|
*/
|
2017-04-10 17:59:44 +00:00
|
|
|
getFilmstripHeight() {
|
2017-05-17 22:40:41 +00:00
|
|
|
// FIXME Make it more clear the getFilmstripHeight check is used in
|
|
|
|
// horizontal film strip mode for calculating how tall large video
|
|
|
|
// display should be.
|
2020-01-24 16:28:47 +00:00
|
|
|
if (isFilmstripVisible(APP.store) && !interfaceConfig.VERTICAL_FILMSTRIP) {
|
|
|
|
return $('.filmstrip').outerHeight();
|
2016-02-24 21:05:24 +00:00
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
|
|
|
return 0;
|
2017-06-14 23:52:59 +00:00
|
|
|
},
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2017-06-14 23:52:59 +00:00
|
|
|
/**
|
2020-02-10 15:27:43 +00:00
|
|
|
* Returns the width of the vertical filmstip if the filmstrip is visible and 0 otherwise.
|
|
|
|
*
|
|
|
|
* @returns {number} - The width of the vertical filmstip if the filmstrip is visible and 0 otherwise.
|
2017-06-14 23:52:59 +00:00
|
|
|
*/
|
2020-02-10 15:27:43 +00:00
|
|
|
getVerticalFilmstripWidth() {
|
|
|
|
return isFilmstripVisible(APP.store) ? getVerticalFilmstripVisibleAreaWidth() : 0;
|
2016-09-15 02:20:54 +00:00
|
|
|
},
|
|
|
|
|
2016-11-07 23:00:50 +00:00
|
|
|
/**
|
2020-01-24 16:28:47 +00:00
|
|
|
* Resizes thumbnails for tile view.
|
2016-11-07 23:00:50 +00:00
|
|
|
*
|
2020-01-24 16:28:47 +00:00
|
|
|
* @param {number} width - The new width of the thumbnails.
|
|
|
|
* @param {number} height - The new height of the thumbnails.
|
|
|
|
* @param {boolean} forceUpdate
|
|
|
|
* @returns {void}
|
2016-11-07 23:00:50 +00:00
|
|
|
*/
|
2020-01-24 16:28:47 +00:00
|
|
|
resizeThumbnailsForTileView(width, height, forceUpdate = false) {
|
|
|
|
const thumbs = this._getThumbs(!forceUpdate);
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
if (thumbs.localThumb) {
|
|
|
|
thumbs.localThumb.css({
|
|
|
|
'padding-top': '',
|
|
|
|
height: `${height}px`,
|
|
|
|
'min-height': `${height}px`,
|
|
|
|
'min-width': `${width}px`,
|
|
|
|
width: `${width}px`
|
|
|
|
});
|
2016-09-15 02:20:54 +00:00
|
|
|
}
|
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
if (thumbs.remoteThumbs) {
|
|
|
|
thumbs.remoteThumbs.css({
|
|
|
|
'padding-top': '',
|
|
|
|
height: `${height}px`,
|
|
|
|
'min-height': `${height}px`,
|
|
|
|
'min-width': `${width}px`,
|
|
|
|
width: `${width}px`
|
2016-11-04 16:13:57 +00:00
|
|
|
});
|
2017-05-17 22:40:41 +00:00
|
|
|
}
|
2016-02-24 21:05:24 +00:00
|
|
|
},
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
/**
|
2020-01-24 16:28:47 +00:00
|
|
|
* Resizes thumbnails for horizontal view.
|
2018-08-08 18:48:23 +00:00
|
|
|
*
|
2020-01-24 16:28:47 +00:00
|
|
|
* @param {Object} dimensions - The new dimensions of the thumbnails.
|
|
|
|
* @param {boolean} forceUpdate
|
|
|
|
* @returns {void}
|
2018-08-08 18:48:23 +00:00
|
|
|
*/
|
2020-01-24 16:28:47 +00:00
|
|
|
resizeThumbnailsForHorizontalView({ local = {}, remote = {} }, forceUpdate = false) {
|
|
|
|
const thumbs = this._getThumbs(!forceUpdate);
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
if (thumbs.localThumb) {
|
|
|
|
const { height, width } = local;
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
thumbs.localThumb.css({
|
|
|
|
height: `${height}px`,
|
|
|
|
'min-height': `${height}px`,
|
|
|
|
'min-width': `${width}px`,
|
|
|
|
width: `${width}px`
|
|
|
|
});
|
|
|
|
}
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
if (thumbs.remoteThumbs) {
|
|
|
|
const { height, width } = remote;
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
thumbs.remoteThumbs.css({
|
|
|
|
height: `${height}px`,
|
|
|
|
'min-height': `${height}px`,
|
|
|
|
'min-width': `${width}px`,
|
|
|
|
width: `${width}px`
|
|
|
|
});
|
|
|
|
}
|
2018-08-08 18:48:23 +00:00
|
|
|
},
|
|
|
|
|
2016-11-03 13:12:45 +00:00
|
|
|
/**
|
2020-01-24 16:28:47 +00:00
|
|
|
* Resizes thumbnails for vertical view.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
2016-11-03 13:12:45 +00:00
|
|
|
*/
|
2020-01-24 16:28:47 +00:00
|
|
|
resizeThumbnailsForVerticalView() {
|
|
|
|
const thumbs = this._getThumbs(true);
|
2018-04-10 19:47:27 +00:00
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
if (thumbs.localThumb) {
|
2020-01-24 16:28:47 +00:00
|
|
|
const heightToWidthPercent = 100 / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
|
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
thumbs.localThumb.css({
|
2020-01-24 16:28:47 +00:00
|
|
|
'padding-top': `${heightToWidthPercent}%`,
|
|
|
|
width: '',
|
|
|
|
height: '',
|
|
|
|
'min-width': '',
|
|
|
|
'min-height': ''
|
2018-04-10 20:01:12 +00:00
|
|
|
});
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
if (thumbs.remoteThumbs) {
|
|
|
|
const heightToWidthPercent = 100 / interfaceConfig.REMOTE_THUMBNAIL_RATIO;
|
2018-08-08 18:48:23 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
thumbs.remoteThumbs.css({
|
|
|
|
'padding-top': `${heightToWidthPercent}%`,
|
|
|
|
width: '',
|
|
|
|
height: '',
|
|
|
|
'min-width': '',
|
|
|
|
'min-height': ''
|
2018-04-10 20:01:12 +00:00
|
|
|
});
|
|
|
|
}
|
2016-02-24 21:05:24 +00:00
|
|
|
},
|
|
|
|
|
2016-11-03 13:12:45 +00:00
|
|
|
/**
|
|
|
|
* Returns thumbnails of the filmstrip
|
2017-10-12 23:02:29 +00:00
|
|
|
* @param onlyVisible
|
2016-11-03 13:12:45 +00:00
|
|
|
* @returns {object} thumbnails
|
|
|
|
*/
|
2020-01-24 16:28:47 +00:00
|
|
|
_getThumbs(onlyVisible = false) {
|
2016-02-24 21:05:24 +00:00
|
|
|
let selector = 'span';
|
2017-10-12 23:02:29 +00:00
|
|
|
|
|
|
|
if (onlyVisible) {
|
2016-02-24 21:05:24 +00:00
|
|
|
selector += ':visible';
|
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const localThumb = $('#localVideoContainer');
|
2020-01-24 16:28:47 +00:00
|
|
|
const remoteThumbs = $('#filmstripRemoteVideosContainer').children(selector);
|
2016-09-15 02:20:54 +00:00
|
|
|
|
2016-05-01 18:35:18 +00:00
|
|
|
// Exclude the local video container if it has been hidden.
|
2017-10-12 23:02:29 +00:00
|
|
|
if (localThumb.hasClass('hidden')) {
|
2016-09-15 02:20:54 +00:00
|
|
|
return { remoteThumbs };
|
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
|
|
|
return { remoteThumbs,
|
|
|
|
localThumb };
|
|
|
|
|
2016-09-28 21:31:40 +00:00
|
|
|
}
|
2016-02-24 21:05:24 +00:00
|
|
|
};
|
|
|
|
|
2017-04-10 17:59:44 +00:00
|
|
|
export default Filmstrip;
|