2017-10-10 23:43:22 +00:00
|
|
|
/* global $, APP, interfaceConfig */
|
2016-02-24 21:05:24 +00:00
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
import {
|
|
|
|
LAYOUTS,
|
|
|
|
getCurrentLayout,
|
|
|
|
getMaxColumnCount,
|
|
|
|
getTileViewGridDimensions,
|
|
|
|
shouldDisplayTileView
|
|
|
|
} from '../../../react/features/video-layout';
|
2017-05-23 18:58:07 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
import UIUtil from '../util/UIUtil';
|
2016-02-24 21:05:24 +00:00
|
|
|
|
2017-04-10 17:59:44 +00:00
|
|
|
const Filmstrip = {
|
2016-03-11 10:55:29 +00:00
|
|
|
/**
|
2018-09-10 22:10:45 +00:00
|
|
|
* Caches jquery lookups of the filmstrip for future use.
|
2016-03-11 10:55:29 +00:00
|
|
|
*/
|
2018-09-10 22:10:45 +00:00
|
|
|
init() {
|
2017-04-10 17:59:44 +00:00
|
|
|
this.filmstripContainerClassName = 'filmstrip';
|
|
|
|
this.filmstrip = $('#remoteVideos');
|
2017-05-17 21:05:48 +00:00
|
|
|
this.filmstripRemoteVideos = $('#filmstripRemoteVideosContainer');
|
2016-02-24 21:05:24 +00:00
|
|
|
},
|
|
|
|
|
2016-11-03 13:12:45 +00:00
|
|
|
/**
|
|
|
|
* Shows if filmstrip is visible
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
2017-04-10 17:59:44 +00:00
|
|
|
isFilmstripVisible() {
|
2018-09-10 22:10:45 +00:00
|
|
|
return APP.store.getState()['features/filmstrip'].visible;
|
2016-02-24 21:05:24 +00:00
|
|
|
},
|
|
|
|
|
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.
|
|
|
|
if (this.isFilmstripVisible() && !interfaceConfig.VERTICAL_FILMSTRIP) {
|
2017-04-10 17:59:44 +00:00
|
|
|
return $(`.${this.filmstripContainerClassName}`).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
|
|
|
/**
|
|
|
|
* Returns the width of filmstip
|
|
|
|
* @returns {number} width
|
|
|
|
*/
|
|
|
|
getFilmstripWidth() {
|
|
|
|
return this.isFilmstripVisible()
|
|
|
|
? this.filmstrip.outerWidth()
|
|
|
|
- parseInt(this.filmstrip.css('paddingLeft'), 10)
|
|
|
|
- parseInt(this.filmstrip.css('paddingRight'), 10)
|
|
|
|
: 0;
|
2016-02-24 21:05:24 +00:00
|
|
|
},
|
|
|
|
|
2016-11-03 13:12:45 +00:00
|
|
|
/**
|
|
|
|
* Calculates the size for thumbnails: local and remote one
|
|
|
|
* @returns {*|{localVideo, remoteVideo}}
|
|
|
|
*/
|
2016-09-15 02:20:54 +00:00
|
|
|
calculateThumbnailSize() {
|
2018-08-08 18:48:23 +00:00
|
|
|
if (shouldDisplayTileView(APP.store.getState())) {
|
|
|
|
return this._calculateThumbnailSizeForTileView();
|
|
|
|
}
|
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const availableSizes = this.calculateAvailableSize();
|
|
|
|
const width = availableSizes.availableWidth;
|
|
|
|
const height = availableSizes.availableHeight;
|
2016-09-15 02:20:54 +00:00
|
|
|
|
|
|
|
return this.calculateThumbnailSizeFromAvailable(width, height);
|
|
|
|
},
|
|
|
|
|
2016-11-07 23:00:50 +00:00
|
|
|
/**
|
|
|
|
* Calculates available size for one thumbnail according to
|
|
|
|
* the current window size.
|
|
|
|
*
|
|
|
|
* @returns {{availableWidth: number, availableHeight: number}}
|
|
|
|
*/
|
2016-09-15 02:20:54 +00:00
|
|
|
calculateAvailableSize() {
|
2018-08-08 18:48:23 +00:00
|
|
|
const state = APP.store.getState();
|
|
|
|
const currentLayout = getCurrentLayout(state);
|
|
|
|
const isHorizontalFilmstripView
|
|
|
|
= currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW;
|
2016-02-24 21:05:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the videoAreaAvailableWidth is set we use this one to calculate
|
2017-04-10 17:59:44 +00:00
|
|
|
* the filmstrip width, because we're probably in a state where the
|
|
|
|
* filmstrip size hasn't been updated yet, but it will be.
|
2016-02-24 21:05:24 +00:00
|
|
|
*/
|
2017-10-12 23:02:29 +00:00
|
|
|
const videoAreaAvailableWidth
|
2016-09-08 18:16:23 +00:00
|
|
|
= UIUtil.getAvailableVideoWidth()
|
2016-11-10 17:07:12 +00:00
|
|
|
- this._getFilmstripExtraPanelsWidth()
|
2017-04-10 17:59:44 +00:00
|
|
|
- UIUtil.parseCssInt(this.filmstrip.css('right'), 10)
|
|
|
|
- UIUtil.parseCssInt(this.filmstrip.css('paddingLeft'), 10)
|
|
|
|
- UIUtil.parseCssInt(this.filmstrip.css('paddingRight'), 10)
|
|
|
|
- UIUtil.parseCssInt(this.filmstrip.css('borderLeftWidth'), 10)
|
|
|
|
- UIUtil.parseCssInt(this.filmstrip.css('borderRightWidth'), 10)
|
2016-05-01 18:35:18 +00:00
|
|
|
- 5;
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
let availableHeight = interfaceConfig.FILM_STRIP_MAX_HEIGHT;
|
2016-05-01 18:35:18 +00:00
|
|
|
let availableWidth = videoAreaAvailableWidth;
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
const thumbs = this.getThumbs(true);
|
|
|
|
|
2016-09-15 02:20:54 +00:00
|
|
|
// If local thumb is not hidden
|
2017-10-12 23:02:29 +00:00
|
|
|
if (thumbs.localThumb) {
|
2018-08-08 18:48:23 +00:00
|
|
|
const localVideoContainer = $('#localVideoContainer');
|
|
|
|
|
2016-05-01 18:35:18 +00:00
|
|
|
availableWidth = Math.floor(
|
2017-10-12 23:02:29 +00:00
|
|
|
videoAreaAvailableWidth - (
|
2017-10-02 23:08:07 +00:00
|
|
|
UIUtil.parseCssInt(
|
|
|
|
localVideoContainer.css('borderLeftWidth'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
localVideoContainer.css('borderRightWidth'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
localVideoContainer.css('paddingLeft'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
localVideoContainer.css('paddingRight'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
localVideoContainer.css('marginLeft'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
2017-10-12 23:02:29 +00:00
|
|
|
localVideoContainer.css('marginRight'), 10))
|
2016-09-15 02:20:54 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
// If the number of videos is 0 or undefined or we're not in horizontal
|
2017-06-05 21:19:05 +00:00
|
|
|
// filmstrip mode we don't need to calculate further any adjustments
|
|
|
|
// to width based on the number of videos present.
|
2018-08-08 18:48:23 +00:00
|
|
|
const numvids = thumbs.remoteThumbs.length;
|
|
|
|
|
|
|
|
if (numvids && isHorizontalFilmstripView) {
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteVideoContainer = thumbs.remoteThumbs.eq(0);
|
|
|
|
|
2016-09-15 02:20:54 +00:00
|
|
|
availableWidth = Math.floor(
|
2017-10-12 23:02:29 +00:00
|
|
|
videoAreaAvailableWidth - (numvids * (
|
2017-10-02 23:08:07 +00:00
|
|
|
UIUtil.parseCssInt(
|
|
|
|
remoteVideoContainer.css('borderLeftWidth'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
remoteVideoContainer.css('borderRightWidth'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
remoteVideoContainer.css('paddingLeft'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
remoteVideoContainer.css('paddingRight'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
remoteVideoContainer.css('marginLeft'), 10)
|
|
|
|
+ UIUtil.parseCssInt(
|
|
|
|
remoteVideoContainer.css('marginRight'), 10)))
|
2016-09-15 02:20:54 +00:00
|
|
|
);
|
|
|
|
}
|
2016-02-24 21:05:24 +00:00
|
|
|
|
2017-10-12 23:02:29 +00:00
|
|
|
const maxHeight
|
|
|
|
|
2016-02-24 21:05:24 +00:00
|
|
|
// If the MAX_HEIGHT property hasn't been specified
|
|
|
|
// we have the static value.
|
2016-09-15 02:20:54 +00:00
|
|
|
= Math.min(interfaceConfig.FILM_STRIP_MAX_HEIGHT || 120,
|
|
|
|
availableHeight);
|
2016-02-24 21:05:24 +00:00
|
|
|
|
|
|
|
availableHeight
|
2016-09-15 02:20:54 +00:00
|
|
|
= Math.min(maxHeight, window.innerHeight - 18);
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
return {
|
|
|
|
availableHeight,
|
|
|
|
availableWidth
|
|
|
|
};
|
2016-09-15 02:20:54 +00:00
|
|
|
},
|
|
|
|
|
2016-11-03 13:12:45 +00:00
|
|
|
/**
|
2016-11-08 11:10:50 +00:00
|
|
|
* Traverse all elements inside the filmstrip
|
|
|
|
* and calculates the sum of all of them except
|
|
|
|
* remote videos element. Used for calculation of
|
2016-11-10 17:07:12 +00:00
|
|
|
* available width for video thumbnails.
|
|
|
|
*
|
2016-11-08 11:10:50 +00:00
|
|
|
* @returns {number} calculated width
|
|
|
|
* @private
|
2016-11-04 16:13:57 +00:00
|
|
|
*/
|
2016-11-10 17:07:12 +00:00
|
|
|
_getFilmstripExtraPanelsWidth() {
|
2017-10-12 23:02:29 +00:00
|
|
|
const className = this.filmstripContainerClassName;
|
2016-11-08 11:10:50 +00:00
|
|
|
let width = 0;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-11-04 16:13:57 +00:00
|
|
|
$(`.${className}`)
|
|
|
|
.children()
|
2017-10-12 23:02:29 +00:00
|
|
|
.each(function() {
|
|
|
|
/* eslint-disable no-invalid-this */
|
2016-11-04 16:13:57 +00:00
|
|
|
if (this.id !== 'remoteVideos') {
|
2016-11-08 11:10:50 +00:00
|
|
|
width += $(this).outerWidth();
|
2016-11-04 16:13:57 +00:00
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
/* eslint-enable no-invalid-this */
|
2016-11-04 16:13:57 +00:00
|
|
|
});
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2016-11-08 11:10:50 +00:00
|
|
|
return width;
|
2016-11-04 16:13:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Calculate the thumbnail size in order to fit all the thumnails in passed
|
2016-09-19 16:20:59 +00:00
|
|
|
* dimensions.
|
|
|
|
* NOTE: Here we assume that the remote and local thumbnails are with the
|
|
|
|
* same height.
|
|
|
|
* @param {int} availableWidth the maximum width for all thumbnails
|
|
|
|
* @param {int} availableHeight the maximum height for all thumbnails
|
2016-11-04 16:13:57 +00:00
|
|
|
* @returns {{localVideo, remoteVideo}}
|
2016-11-03 13:12:45 +00:00
|
|
|
*/
|
2016-09-15 02:20:54 +00:00
|
|
|
calculateThumbnailSizeFromAvailable(availableWidth, availableHeight) {
|
2016-09-19 16:20:59 +00:00
|
|
|
/**
|
|
|
|
* Let:
|
|
|
|
* lW - width of the local thumbnail
|
|
|
|
* rW - width of the remote thumbnail
|
|
|
|
* h - the height of the thumbnails
|
|
|
|
* remoteRatio - width:height for the remote thumbnail
|
|
|
|
* localRatio - width:height for the local thumbnail
|
2017-06-05 21:19:05 +00:00
|
|
|
* remoteThumbsInRow - number of remote thumbnails in a row (we have
|
|
|
|
* only one local thumbnail) next to the local thumbnail. In vertical
|
|
|
|
* filmstrip mode, this will always be 0.
|
2016-09-19 16:20:59 +00:00
|
|
|
*
|
|
|
|
* Since the height for local thumbnail = height for remote thumbnail
|
|
|
|
* and we know the ratio (width:height) for the local and for the
|
|
|
|
* remote thumbnail we can find rW/lW:
|
|
|
|
* rW / remoteRatio = lW / localRatio then -
|
|
|
|
* remoteLocalWidthRatio = rW / lW = remoteRatio / localRatio
|
|
|
|
* and rW = lW * remoteRatio / localRatio = lW * remoteLocalWidthRatio
|
|
|
|
* And the total width for the thumbnails is:
|
2017-06-05 21:19:05 +00:00
|
|
|
* totalWidth = rW * remoteThumbsInRow + lW
|
|
|
|
* = lW * remoteLocalWidthRatio * remoteThumbsInRow + lW =
|
|
|
|
* lW * (remoteLocalWidthRatio * remoteThumbsInRow + 1)
|
2016-09-19 16:20:59 +00:00
|
|
|
* and the h = lW/localRatio
|
|
|
|
*
|
|
|
|
* In order to fit all the thumbails in the area defined by
|
|
|
|
* availableWidth * availableHeight we should check one of the
|
|
|
|
* following options:
|
|
|
|
* 1) if availableHeight == h - totalWidth should be less than
|
|
|
|
* availableWidth
|
|
|
|
* 2) if availableWidth == totalWidth - h should be less than
|
|
|
|
* availableHeight
|
|
|
|
*
|
|
|
|
* 1) or 2) will be true and we are going to use it to calculate all
|
|
|
|
* sizes.
|
|
|
|
*
|
|
|
|
* if 1) is true that means that
|
|
|
|
* availableHeight/h > availableWidth/totalWidth otherwise 2) is true
|
|
|
|
*/
|
2016-09-15 02:20:54 +00:00
|
|
|
|
2017-06-05 21:19:05 +00:00
|
|
|
const remoteThumbsInRow = interfaceConfig.VERTICAL_FILMSTRIP
|
|
|
|
? 0 : this.getThumbs(true).remoteThumbs.length;
|
2017-10-12 23:02:29 +00:00
|
|
|
const remoteLocalWidthRatio = interfaceConfig.REMOTE_THUMBNAIL_RATIO
|
|
|
|
/ interfaceConfig.LOCAL_THUMBNAIL_RATIO;
|
|
|
|
const lW = Math.min(availableWidth
|
|
|
|
/ ((remoteLocalWidthRatio * remoteThumbsInRow) + 1), availableHeight
|
|
|
|
* interfaceConfig.LOCAL_THUMBNAIL_RATIO);
|
2016-09-19 16:20:59 +00:00
|
|
|
const h = lW / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
|
2017-05-17 22:40:41 +00:00
|
|
|
|
2017-06-05 21:19:05 +00:00
|
|
|
const remoteVideoWidth = lW * remoteLocalWidthRatio;
|
2017-05-17 22:40:41 +00:00
|
|
|
|
|
|
|
let localVideo;
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2017-05-17 22:40:41 +00:00
|
|
|
if (interfaceConfig.VERTICAL_FILMSTRIP) {
|
|
|
|
localVideo = {
|
2017-06-05 21:19:05 +00:00
|
|
|
thumbWidth: remoteVideoWidth,
|
2017-05-17 22:40:41 +00:00
|
|
|
thumbHeight: h * remoteLocalWidthRatio
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
localVideo = {
|
|
|
|
thumbWidth: lW,
|
|
|
|
thumbHeight: h
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-11-04 16:13:57 +00:00
|
|
|
return {
|
2017-06-05 21:19:05 +00:00
|
|
|
localVideo,
|
|
|
|
remoteVideo: {
|
|
|
|
thumbWidth: remoteVideoWidth,
|
|
|
|
thumbHeight: h
|
|
|
|
}
|
|
|
|
};
|
2016-02-24 21:05:24 +00:00
|
|
|
},
|
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
/**
|
|
|
|
* Calculates the size for thumbnails when in tile view layout.
|
|
|
|
*
|
|
|
|
* @returns {{localVideo, remoteVideo}}
|
|
|
|
*/
|
|
|
|
_calculateThumbnailSizeForTileView() {
|
|
|
|
const tileAspectRatio = 16 / 9;
|
|
|
|
|
|
|
|
// The distance from the top and bottom of the screen, as set by CSS, to
|
|
|
|
// avoid overlapping UI elements.
|
|
|
|
const topBottomPadding = 200;
|
|
|
|
|
|
|
|
// Minimum space to keep between the sides of the tiles and the sides
|
|
|
|
// of the window.
|
|
|
|
const sideMargins = 30 * 2;
|
|
|
|
|
|
|
|
const state = APP.store.getState();
|
|
|
|
|
|
|
|
const viewWidth = document.body.clientWidth - sideMargins;
|
|
|
|
const viewHeight = document.body.clientHeight - topBottomPadding;
|
|
|
|
|
|
|
|
const {
|
|
|
|
columns,
|
|
|
|
visibleRows
|
|
|
|
} = getTileViewGridDimensions(state, getMaxColumnCount());
|
|
|
|
const initialWidth = viewWidth / columns;
|
|
|
|
const aspectRatioHeight = initialWidth / tileAspectRatio;
|
|
|
|
|
2018-11-28 21:36:12 +00:00
|
|
|
const heightOfEach = Math.floor(Math.min(
|
2018-08-08 18:48:23 +00:00
|
|
|
aspectRatioHeight,
|
2018-11-28 21:36:12 +00:00
|
|
|
viewHeight / visibleRows
|
|
|
|
));
|
|
|
|
const widthOfEach = Math.floor(tileAspectRatio * heightOfEach);
|
2018-08-08 18:48:23 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
localVideo: {
|
|
|
|
thumbWidth: widthOfEach,
|
|
|
|
thumbHeight: heightOfEach
|
|
|
|
},
|
|
|
|
remoteVideo: {
|
|
|
|
thumbWidth: widthOfEach,
|
|
|
|
thumbHeight: heightOfEach
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2016-11-03 13:12:45 +00:00
|
|
|
/**
|
|
|
|
* Resizes thumbnails
|
|
|
|
* @param local
|
|
|
|
* @param remote
|
|
|
|
* @param forceUpdate
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
2018-04-10 20:03:44 +00:00
|
|
|
// eslint-disable-next-line max-params
|
|
|
|
resizeThumbnails(local, remote, forceUpdate = false) {
|
2018-08-08 18:48:23 +00:00
|
|
|
const state = APP.store.getState();
|
|
|
|
|
|
|
|
if (shouldDisplayTileView(state)) {
|
|
|
|
// The size of the side margins for each tile as set in CSS.
|
|
|
|
const sideMargins = 10 * 2;
|
|
|
|
const {
|
|
|
|
columns,
|
|
|
|
rows
|
|
|
|
} = getTileViewGridDimensions(state, getMaxColumnCount());
|
|
|
|
const hasOverflow = rows > columns;
|
|
|
|
|
|
|
|
// Width is set so that the flex layout can automatically wrap
|
|
|
|
// tiles onto new rows.
|
|
|
|
this.filmstripRemoteVideos.css({
|
|
|
|
width: (local.thumbWidth * columns) + (columns * sideMargins)
|
|
|
|
});
|
|
|
|
|
|
|
|
this.filmstripRemoteVideos.toggleClass('has-overflow', hasOverflow);
|
|
|
|
} else {
|
|
|
|
this.filmstripRemoteVideos.css('width', '');
|
|
|
|
}
|
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
const thumbs = this.getThumbs(!forceUpdate);
|
2018-04-10 19:47:27 +00:00
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
if (thumbs.localThumb) {
|
2017-10-12 23:02:29 +00:00
|
|
|
// eslint-disable-next-line no-shadow
|
2018-04-10 20:01:12 +00:00
|
|
|
thumbs.localThumb.css({
|
|
|
|
display: 'inline-block',
|
|
|
|
height: `${local.thumbHeight}px`,
|
|
|
|
'min-height': `${local.thumbHeight}px`,
|
|
|
|
'min-width': `${local.thumbWidth}px`,
|
|
|
|
width: `${local.thumbWidth}px`
|
|
|
|
});
|
2019-05-23 20:11:14 +00:00
|
|
|
|
|
|
|
const avatarSize = local.thumbHeight / 2;
|
|
|
|
|
|
|
|
thumbs.localThumb.find('.avatar-container')
|
|
|
|
.height(avatarSize)
|
|
|
|
.width(avatarSize);
|
2018-04-10 20:01:12 +00:00
|
|
|
}
|
2016-11-11 15:09:07 +00:00
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
if (thumbs.remoteThumbs) {
|
|
|
|
thumbs.remoteThumbs.css({
|
|
|
|
display: 'inline-block',
|
|
|
|
height: `${remote.thumbHeight}px`,
|
|
|
|
'min-height': `${remote.thumbHeight}px`,
|
|
|
|
'min-width': `${remote.thumbWidth}px`,
|
|
|
|
width: `${remote.thumbWidth}px`
|
|
|
|
});
|
2019-05-23 20:11:14 +00:00
|
|
|
|
|
|
|
const avatarSize = remote.thumbHeight / 2;
|
|
|
|
|
|
|
|
thumbs.remoteThumbs.find('.avatar-container')
|
|
|
|
.height(avatarSize)
|
|
|
|
.width(avatarSize);
|
2018-04-10 20:01:12 +00:00
|
|
|
}
|
2017-10-12 23:02:29 +00:00
|
|
|
|
2018-08-08 18:48:23 +00:00
|
|
|
const currentLayout = getCurrentLayout(APP.store.getState());
|
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
// Let CSS take care of height in vertical filmstrip mode.
|
2018-08-08 18:48:23 +00:00
|
|
|
if (currentLayout === LAYOUTS.VERTICAL_FILMSTRIP_VIEW) {
|
2018-04-10 20:01:12 +00:00
|
|
|
$('#filmstripLocalVideo').css({
|
|
|
|
// adds 4 px because of small video 2px border
|
|
|
|
width: `${local.thumbWidth + 4}px`
|
|
|
|
});
|
2018-08-08 18:48:23 +00:00
|
|
|
} else if (currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
|
2018-04-10 20:01:12 +00:00
|
|
|
this.filmstrip.css({
|
|
|
|
// adds 4 px because of small video 2px border
|
|
|
|
height: `${remote.thumbHeight + 4}px`
|
|
|
|
});
|
|
|
|
}
|
2016-02-24 21:05:24 +00:00
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
const { localThumb } = this.getThumbs();
|
|
|
|
const height = localThumb ? localThumb.height() : 0;
|
|
|
|
const fontSize = UIUtil.getIndicatorFontSize(height);
|
2016-11-11 14:05:41 +00:00
|
|
|
|
2018-04-10 20:01:12 +00:00
|
|
|
this.filmstrip.find('.indicator').css({
|
|
|
|
'font-size': `${fontSize}px`
|
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
|
|
|
|
*/
|
2017-10-12 23:02:29 +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');
|
|
|
|
const remoteThumbs = this.filmstripRemoteVideos.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;
|