2020-01-24 16:28:47 +00:00
|
|
|
// @flow
|
2021-03-26 20:23:05 +00:00
|
|
|
import type { Dispatch } from 'redux';
|
2020-01-24 16:28:47 +00:00
|
|
|
|
2022-04-04 18:57:58 +00:00
|
|
|
import { getSourceNameSignalingFeatureFlag } from '../base/config';
|
2022-03-11 00:27:37 +00:00
|
|
|
import {
|
|
|
|
getLocalParticipant,
|
|
|
|
getParticipantById,
|
2022-03-15 17:34:46 +00:00
|
|
|
getRemoteParticipantCount,
|
2022-03-11 00:27:37 +00:00
|
|
|
pinParticipant
|
|
|
|
} from '../base/participants';
|
2021-12-16 16:55:45 +00:00
|
|
|
import { shouldHideSelfView } from '../base/settings/functions.any';
|
2022-03-11 00:27:37 +00:00
|
|
|
import { getMaxColumnCount } from '../video-layout';
|
2020-03-09 11:54:54 +00:00
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
import {
|
2022-03-29 08:45:09 +00:00
|
|
|
ADD_STAGE_PARTICIPANT,
|
|
|
|
REMOVE_STAGE_PARTICIPANT,
|
|
|
|
SET_STAGE_PARTICIPANTS,
|
2022-02-24 12:20:37 +00:00
|
|
|
SET_FILMSTRIP_WIDTH,
|
2021-03-26 20:23:05 +00:00
|
|
|
SET_HORIZONTAL_VIEW_DIMENSIONS,
|
2022-03-29 08:45:09 +00:00
|
|
|
SET_STAGE_FILMSTRIP_DIMENSIONS,
|
2021-03-26 20:23:05 +00:00
|
|
|
SET_TILE_VIEW_DIMENSIONS,
|
2022-02-24 12:20:37 +00:00
|
|
|
SET_USER_FILMSTRIP_WIDTH,
|
2022-03-14 11:11:22 +00:00
|
|
|
SET_USER_IS_RESIZING,
|
2021-03-26 20:23:05 +00:00
|
|
|
SET_VERTICAL_VIEW_DIMENSIONS,
|
2022-04-07 08:31:53 +00:00
|
|
|
SET_VOLUME,
|
2022-04-12 06:57:01 +00:00
|
|
|
SET_MAX_STAGE_PARTICIPANTS,
|
2022-04-12 13:19:10 +00:00
|
|
|
TOGGLE_PIN_STAGE_PARTICIPANT,
|
2022-06-29 13:59:49 +00:00
|
|
|
CLEAR_STAGE_PARTICIPANTS,
|
|
|
|
SET_SCREENSHARING_TILE_DIMENSIONS,
|
|
|
|
SET_USER_FILMSTRIP_HEIGHT,
|
|
|
|
SET_FILMSTRIP_HEIGHT,
|
|
|
|
SET_TOP_PANEL_VISIBILITY
|
2021-03-26 20:23:05 +00:00
|
|
|
} from './actionTypes';
|
|
|
|
import {
|
|
|
|
HORIZONTAL_FILMSTRIP_MARGIN,
|
2022-03-29 08:45:09 +00:00
|
|
|
MAX_ACTIVE_PARTICIPANTS,
|
2021-03-26 20:23:05 +00:00
|
|
|
SCROLL_SIZE,
|
|
|
|
STAGE_VIEW_THUMBNAIL_VERTICAL_BORDER,
|
|
|
|
TILE_HORIZONTAL_MARGIN,
|
2022-06-29 13:59:49 +00:00
|
|
|
TILE_MIN_HEIGHT_SMALL,
|
2022-02-24 12:20:37 +00:00
|
|
|
TILE_VERTICAL_CONTAINER_HORIZONTAL_MARGIN,
|
2021-03-26 20:23:05 +00:00
|
|
|
TILE_VERTICAL_MARGIN,
|
2022-03-11 00:27:37 +00:00
|
|
|
TILE_VIEW_DEFAULT_NUMBER_OF_VISIBLE_TILES,
|
|
|
|
TILE_VIEW_GRID_HORIZONTAL_MARGIN,
|
|
|
|
TILE_VIEW_GRID_VERTICAL_MARGIN,
|
2022-06-29 13:59:49 +00:00
|
|
|
TOP_FILMSTRIP_HEIGHT,
|
2021-03-26 20:23:05 +00:00
|
|
|
VERTICAL_FILMSTRIP_VERTICAL_MARGIN
|
|
|
|
} from './constants';
|
|
|
|
import {
|
2022-03-29 08:45:09 +00:00
|
|
|
calculateNonResponsiveTileViewDimensions,
|
2022-03-11 00:27:37 +00:00
|
|
|
calculateResponsiveTileViewDimensions,
|
2021-03-26 20:23:05 +00:00
|
|
|
calculateThumbnailSizeForHorizontalView,
|
2022-02-24 12:20:37 +00:00
|
|
|
calculateThumbnailSizeForVerticalView,
|
2022-03-12 03:44:34 +00:00
|
|
|
getNumberOfPartipantsForTileView,
|
2022-03-29 08:45:09 +00:00
|
|
|
getVerticalViewMaxWidth,
|
2022-02-24 12:20:37 +00:00
|
|
|
isFilmstripResizable,
|
2022-06-29 13:59:49 +00:00
|
|
|
isStageFilmstripTopPanel,
|
2022-02-24 12:20:37 +00:00
|
|
|
showGridInVerticalView
|
2021-03-26 20:23:05 +00:00
|
|
|
} from './functions';
|
2022-06-15 11:04:06 +00:00
|
|
|
import { isStageFilmstripAvailable } from './functions.web';
|
2020-01-24 16:28:47 +00:00
|
|
|
|
2021-08-23 23:02:41 +00:00
|
|
|
export * from './actions.any';
|
2021-08-18 22:34:01 +00:00
|
|
|
|
2020-01-24 16:28:47 +00:00
|
|
|
/**
|
|
|
|
* Sets the dimensions of the tile view grid.
|
|
|
|
*
|
2021-03-26 20:23:05 +00:00
|
|
|
* @returns {Function}
|
2020-01-24 16:28:47 +00:00
|
|
|
*/
|
2022-03-11 00:27:37 +00:00
|
|
|
export function setTileViewDimensions() {
|
2021-03-26 20:23:05 +00:00
|
|
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
|
|
|
const state = getState();
|
|
|
|
const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
|
|
|
|
const {
|
2021-12-20 09:32:31 +00:00
|
|
|
disableResponsiveTiles,
|
2022-03-11 00:27:37 +00:00
|
|
|
disableTileEnlargement,
|
|
|
|
tileView = {}
|
|
|
|
} = state['features/base/config'];
|
|
|
|
const { numberOfVisibleTiles = TILE_VIEW_DEFAULT_NUMBER_OF_VISIBLE_TILES } = tileView;
|
|
|
|
const numberOfParticipants = getNumberOfPartipantsForTileView(state);
|
|
|
|
const maxColumns = getMaxColumnCount(state);
|
|
|
|
|
|
|
|
const {
|
|
|
|
height,
|
|
|
|
width,
|
|
|
|
columns,
|
|
|
|
rows
|
|
|
|
} = disableResponsiveTiles
|
2022-03-29 08:45:09 +00:00
|
|
|
? calculateNonResponsiveTileViewDimensions(state)
|
2022-03-11 00:27:37 +00:00
|
|
|
: calculateResponsiveTileViewDimensions({
|
|
|
|
clientWidth,
|
|
|
|
clientHeight,
|
|
|
|
disableTileEnlargement,
|
|
|
|
maxColumns,
|
|
|
|
numberOfParticipants,
|
2022-03-25 15:40:46 +00:00
|
|
|
desiredNumberOfVisibleTiles: numberOfVisibleTiles
|
2022-03-11 00:27:37 +00:00
|
|
|
});
|
2021-03-26 20:23:05 +00:00
|
|
|
const thumbnailsTotalHeight = rows * (TILE_VERTICAL_MARGIN + height);
|
2022-03-25 15:40:46 +00:00
|
|
|
const availableHeight = clientHeight - TILE_VIEW_GRID_VERTICAL_MARGIN;
|
|
|
|
const hasScroll = availableHeight < thumbnailsTotalHeight;
|
2022-03-11 00:27:37 +00:00
|
|
|
const filmstripWidth
|
|
|
|
= Math.min(clientWidth - TILE_VIEW_GRID_HORIZONTAL_MARGIN, columns * (TILE_HORIZONTAL_MARGIN + width))
|
|
|
|
+ (hasScroll ? SCROLL_SIZE : 0);
|
2022-03-25 15:40:46 +00:00
|
|
|
const filmstripHeight = Math.min(availableHeight, thumbnailsTotalHeight);
|
2020-03-09 11:54:54 +00:00
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
dispatch({
|
|
|
|
type: SET_TILE_VIEW_DIMENSIONS,
|
|
|
|
dimensions: {
|
2022-03-11 00:27:37 +00:00
|
|
|
gridDimensions: {
|
|
|
|
columns,
|
|
|
|
rows
|
|
|
|
},
|
2021-03-26 20:23:05 +00:00
|
|
|
thumbnailSize: {
|
|
|
|
height,
|
|
|
|
width
|
|
|
|
},
|
|
|
|
filmstripHeight,
|
2022-03-11 00:27:37 +00:00
|
|
|
filmstripWidth,
|
|
|
|
hasScroll
|
2021-03-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
2020-01-24 16:28:47 +00:00
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
/**
|
|
|
|
* Sets the dimensions of the thumbnails in vertical view.
|
|
|
|
*
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function setVerticalViewDimensions() {
|
|
|
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
|
|
|
const state = getState();
|
|
|
|
const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
|
2022-02-24 12:20:37 +00:00
|
|
|
const { width: filmstripWidth } = state['features/filmstrip'];
|
2021-12-16 16:55:45 +00:00
|
|
|
const disableSelfView = shouldHideSelfView(state);
|
2022-02-24 12:20:37 +00:00
|
|
|
const resizableFilmstrip = isFilmstripResizable(state);
|
|
|
|
const _verticalViewGrid = showGridInVerticalView(state);
|
2022-03-15 17:34:46 +00:00
|
|
|
const numberOfRemoteParticipants = getRemoteParticipantCount(state);
|
2022-04-04 18:57:58 +00:00
|
|
|
const { localScreenShare } = state['features/base/participants'];
|
2022-02-24 12:20:37 +00:00
|
|
|
|
|
|
|
let gridView = {};
|
|
|
|
let thumbnails = {};
|
|
|
|
let filmstripDimensions = {};
|
2022-03-15 17:34:46 +00:00
|
|
|
let hasScroll = false;
|
|
|
|
let remoteVideosContainerWidth;
|
|
|
|
let remoteVideosContainerHeight;
|
2022-02-24 12:20:37 +00:00
|
|
|
|
|
|
|
// grid view in the vertical filmstrip
|
|
|
|
if (_verticalViewGrid) {
|
2022-03-11 00:27:37 +00:00
|
|
|
const { tileView = {} } = state['features/base/config'];
|
|
|
|
const { numberOfVisibleTiles = TILE_VIEW_DEFAULT_NUMBER_OF_VISIBLE_TILES } = tileView;
|
|
|
|
const numberOfParticipants = getNumberOfPartipantsForTileView(state);
|
2022-03-25 15:40:46 +00:00
|
|
|
const maxColumns = getMaxColumnCount(state, {
|
|
|
|
width: filmstripWidth.current,
|
|
|
|
disableResponsiveTiles: false,
|
|
|
|
disableTileEnlargement: false
|
|
|
|
});
|
2022-02-24 12:20:37 +00:00
|
|
|
const {
|
|
|
|
height,
|
2022-03-11 00:27:37 +00:00
|
|
|
width,
|
|
|
|
columns,
|
|
|
|
rows
|
|
|
|
} = calculateResponsiveTileViewDimensions({
|
2022-02-24 12:20:37 +00:00
|
|
|
clientWidth: filmstripWidth.current,
|
|
|
|
clientHeight,
|
|
|
|
disableTileEnlargement: false,
|
2022-03-11 00:27:37 +00:00
|
|
|
maxColumns,
|
2022-03-29 08:45:09 +00:00
|
|
|
noHorizontalContainerMargin: true,
|
2022-03-11 00:27:37 +00:00
|
|
|
numberOfParticipants,
|
2022-03-25 15:40:46 +00:00
|
|
|
desiredNumberOfVisibleTiles: numberOfVisibleTiles
|
2022-02-24 12:20:37 +00:00
|
|
|
});
|
|
|
|
const thumbnailsTotalHeight = rows * (TILE_VERTICAL_MARGIN + height);
|
2022-03-15 17:34:46 +00:00
|
|
|
|
|
|
|
hasScroll = clientHeight < thumbnailsTotalHeight;
|
2022-02-24 12:20:37 +00:00
|
|
|
const widthOfFilmstrip = (columns * (TILE_HORIZONTAL_MARGIN + width)) + (hasScroll ? SCROLL_SIZE : 0);
|
2022-03-12 03:44:34 +00:00
|
|
|
const filmstripHeight = Math.min(clientHeight - TILE_VIEW_GRID_VERTICAL_MARGIN, thumbnailsTotalHeight);
|
2022-02-24 12:20:37 +00:00
|
|
|
|
|
|
|
gridView = {
|
2022-03-11 00:27:37 +00:00
|
|
|
gridDimensions: {
|
|
|
|
columns,
|
|
|
|
rows
|
|
|
|
},
|
2022-02-24 12:20:37 +00:00
|
|
|
thumbnailSize: {
|
|
|
|
height,
|
|
|
|
width
|
2022-03-12 03:44:34 +00:00
|
|
|
},
|
|
|
|
hasScroll
|
2022-02-24 12:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
filmstripDimensions = {
|
|
|
|
height: filmstripHeight,
|
|
|
|
width: widthOfFilmstrip
|
|
|
|
};
|
|
|
|
} else {
|
2022-03-02 14:46:20 +00:00
|
|
|
thumbnails = calculateThumbnailSizeForVerticalView(clientWidth, filmstripWidth.current, resizableFilmstrip);
|
2022-03-15 17:34:46 +00:00
|
|
|
|
|
|
|
remoteVideosContainerWidth
|
|
|
|
= thumbnails?.local?.width + TILE_VERTICAL_CONTAINER_HORIZONTAL_MARGIN + SCROLL_SIZE;
|
|
|
|
remoteVideosContainerHeight
|
|
|
|
= clientHeight - (disableSelfView ? 0 : thumbnails?.local?.height) - VERTICAL_FILMSTRIP_VERTICAL_MARGIN;
|
2022-04-04 18:57:58 +00:00
|
|
|
|
|
|
|
if (getSourceNameSignalingFeatureFlag(state)) {
|
|
|
|
// Account for the height of the local screen share thumbnail when calculating the height of the remote
|
|
|
|
// videos container.
|
|
|
|
const localCameraThumbnailHeight = thumbnails?.local?.height;
|
|
|
|
const localScreenShareThumbnailHeight
|
|
|
|
= localScreenShare && !disableSelfView ? thumbnails?.local?.height : 0;
|
|
|
|
|
|
|
|
remoteVideosContainerHeight = clientHeight
|
|
|
|
- localCameraThumbnailHeight
|
|
|
|
- localScreenShareThumbnailHeight
|
|
|
|
- VERTICAL_FILMSTRIP_VERTICAL_MARGIN;
|
|
|
|
}
|
|
|
|
|
2022-03-15 17:34:46 +00:00
|
|
|
hasScroll
|
|
|
|
= remoteVideosContainerHeight
|
|
|
|
< (thumbnails?.remote.height + TILE_VERTICAL_MARGIN) * numberOfRemoteParticipants;
|
2022-02-24 12:20:37 +00:00
|
|
|
}
|
2021-03-26 20:23:05 +00:00
|
|
|
|
|
|
|
dispatch({
|
|
|
|
type: SET_VERTICAL_VIEW_DIMENSIONS,
|
|
|
|
dimensions: {
|
|
|
|
...thumbnails,
|
2022-02-24 12:20:37 +00:00
|
|
|
remoteVideosContainer: _verticalViewGrid ? filmstripDimensions : {
|
2022-03-15 17:34:46 +00:00
|
|
|
width: remoteVideosContainerWidth,
|
|
|
|
height: remoteVideosContainerHeight
|
2022-02-24 12:20:37 +00:00
|
|
|
},
|
2022-03-15 17:34:46 +00:00
|
|
|
gridView,
|
|
|
|
hasScroll
|
2021-03-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
});
|
2020-01-24 16:28:47 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the dimensions of the thumbnails in horizontal view.
|
|
|
|
*
|
2021-03-26 20:23:05 +00:00
|
|
|
* @returns {Function}
|
2020-01-24 16:28:47 +00:00
|
|
|
*/
|
2021-03-26 20:23:05 +00:00
|
|
|
export function setHorizontalViewDimensions() {
|
|
|
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
|
|
|
const state = getState();
|
|
|
|
const { clientHeight = 0, clientWidth = 0 } = state['features/base/responsive-ui'];
|
2021-12-16 16:55:45 +00:00
|
|
|
const disableSelfView = shouldHideSelfView(state);
|
2021-03-26 20:23:05 +00:00
|
|
|
const thumbnails = calculateThumbnailSizeForHorizontalView(clientHeight);
|
2022-03-15 17:34:46 +00:00
|
|
|
const remoteVideosContainerWidth
|
|
|
|
= clientWidth - (disableSelfView ? 0 : thumbnails?.local?.width) - HORIZONTAL_FILMSTRIP_MARGIN;
|
|
|
|
const remoteVideosContainerHeight
|
|
|
|
= thumbnails?.local?.height + TILE_VERTICAL_MARGIN + STAGE_VIEW_THUMBNAIL_VERTICAL_BORDER + SCROLL_SIZE;
|
|
|
|
const numberOfRemoteParticipants = getRemoteParticipantCount(state);
|
|
|
|
const hasScroll
|
|
|
|
= remoteVideosContainerHeight
|
|
|
|
< (thumbnails?.remote.width + TILE_HORIZONTAL_MARGIN) * numberOfRemoteParticipants;
|
2021-03-26 20:23:05 +00:00
|
|
|
|
|
|
|
dispatch({
|
|
|
|
type: SET_HORIZONTAL_VIEW_DIMENSIONS,
|
|
|
|
dimensions: {
|
|
|
|
...thumbnails,
|
|
|
|
remoteVideosContainer: {
|
2022-03-15 17:34:46 +00:00
|
|
|
width: remoteVideosContainerWidth,
|
|
|
|
height: remoteVideosContainerHeight
|
|
|
|
},
|
|
|
|
hasScroll
|
2021-03-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
});
|
2020-01-24 16:28:47 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-03-29 08:45:09 +00:00
|
|
|
/**
|
|
|
|
* Sets the dimensions of the stage filmstrip tile view grid.
|
|
|
|
*
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function setStageFilmstripViewDimensions() {
|
|
|
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
|
|
|
const state = getState();
|
|
|
|
const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
|
|
|
|
const {
|
|
|
|
tileView = {}
|
|
|
|
} = state['features/base/config'];
|
2022-06-29 13:59:49 +00:00
|
|
|
const { visible, topPanelHeight } = state['features/filmstrip'];
|
2022-03-29 08:45:09 +00:00
|
|
|
const verticalWidth = visible ? getVerticalViewMaxWidth(state) : 0;
|
|
|
|
const { numberOfVisibleTiles = MAX_ACTIVE_PARTICIPANTS } = tileView;
|
|
|
|
const numberOfParticipants = state['features/filmstrip'].activeParticipants.length;
|
2022-03-25 15:40:46 +00:00
|
|
|
const availableWidth = clientWidth - verticalWidth;
|
2022-04-20 08:00:20 +00:00
|
|
|
const maxColumns = getMaxColumnCount(state, {
|
|
|
|
width: availableWidth,
|
|
|
|
disableResponsiveTiles: false,
|
|
|
|
disableTileEnlargement: false
|
|
|
|
});
|
2022-06-29 13:59:49 +00:00
|
|
|
const topPanel = isStageFilmstripTopPanel(state);
|
2022-03-29 08:45:09 +00:00
|
|
|
|
|
|
|
const {
|
|
|
|
height,
|
|
|
|
width,
|
|
|
|
columns,
|
|
|
|
rows
|
2022-04-12 13:19:10 +00:00
|
|
|
} = calculateResponsiveTileViewDimensions({
|
|
|
|
clientWidth: availableWidth,
|
2022-06-29 13:59:49 +00:00
|
|
|
clientHeight: topPanel ? topPanelHeight?.current || TOP_FILMSTRIP_HEIGHT : clientHeight,
|
2022-04-12 13:19:10 +00:00
|
|
|
disableTileEnlargement: false,
|
|
|
|
maxColumns,
|
|
|
|
noHorizontalContainerMargin: verticalWidth > 0,
|
|
|
|
numberOfParticipants,
|
2022-06-29 13:59:49 +00:00
|
|
|
numberOfVisibleTiles,
|
|
|
|
minTileHeight: topPanel ? TILE_MIN_HEIGHT_SMALL : null
|
2022-04-12 13:19:10 +00:00
|
|
|
});
|
2022-03-29 08:45:09 +00:00
|
|
|
const thumbnailsTotalHeight = rows * (TILE_VERTICAL_MARGIN + height);
|
|
|
|
const hasScroll = clientHeight < thumbnailsTotalHeight;
|
|
|
|
const filmstripWidth
|
|
|
|
= Math.min(clientWidth - TILE_VIEW_GRID_HORIZONTAL_MARGIN, columns * (TILE_HORIZONTAL_MARGIN + width))
|
|
|
|
+ (hasScroll ? SCROLL_SIZE : 0);
|
|
|
|
const filmstripHeight = Math.min(clientHeight - TILE_VIEW_GRID_VERTICAL_MARGIN, thumbnailsTotalHeight);
|
|
|
|
|
|
|
|
dispatch({
|
|
|
|
type: SET_STAGE_FILMSTRIP_DIMENSIONS,
|
|
|
|
dimensions: {
|
|
|
|
gridDimensions: {
|
|
|
|
columns,
|
|
|
|
rows
|
|
|
|
},
|
|
|
|
thumbnailSize: {
|
|
|
|
height,
|
|
|
|
width
|
|
|
|
},
|
|
|
|
filmstripHeight,
|
|
|
|
filmstripWidth,
|
|
|
|
hasScroll
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-01-21 20:46:47 +00:00
|
|
|
/**
|
|
|
|
* Emulates a click on the n-th video.
|
|
|
|
*
|
|
|
|
* @param {number} n - Number that identifies the video.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function clickOnVideo(n: number) {
|
|
|
|
return (dispatch: Function, getState: Function) => {
|
2021-07-09 12:36:19 +00:00
|
|
|
const state = getState();
|
2021-08-19 19:41:17 +00:00
|
|
|
const { id: localId } = getLocalParticipant(state);
|
|
|
|
|
2021-08-19 21:56:45 +00:00
|
|
|
// Use the list that correctly represents the current order of the participants as visible in the UI.
|
2021-08-19 19:41:17 +00:00
|
|
|
const { remoteParticipants } = state['features/filmstrip'];
|
|
|
|
const participants = [ localId, ...remoteParticipants ];
|
2022-06-15 11:04:06 +00:00
|
|
|
|
|
|
|
if (participants.length - 1 < n) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-19 19:41:17 +00:00
|
|
|
const { id, pinned } = getParticipantById(state, participants[n]);
|
2021-01-21 20:46:47 +00:00
|
|
|
|
2022-06-15 11:04:06 +00:00
|
|
|
if (isStageFilmstripAvailable(state)) {
|
|
|
|
dispatch(togglePinStageParticipant(id));
|
|
|
|
} else {
|
|
|
|
dispatch(pinParticipant(pinned ? null : id));
|
|
|
|
}
|
2021-01-21 20:46:47 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-03-26 20:23:05 +00:00
|
|
|
/**
|
2021-06-30 07:30:38 +00:00
|
|
|
* Sets the volume for a thumbnail's audio.
|
2021-03-26 20:23:05 +00:00
|
|
|
*
|
2022-07-14 07:10:08 +00:00
|
|
|
* @param {string} participantId - The participant ID associated with the audio.
|
2021-03-26 20:23:05 +00:00
|
|
|
* @param {string} volume - The volume level.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_VOLUME,
|
|
|
|
* participantId: string,
|
|
|
|
* volume: number
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setVolume(participantId: string, volume: number) {
|
|
|
|
return {
|
|
|
|
type: SET_VOLUME,
|
|
|
|
participantId,
|
|
|
|
volume
|
|
|
|
};
|
|
|
|
}
|
2022-02-24 12:20:37 +00:00
|
|
|
|
2022-06-29 13:59:49 +00:00
|
|
|
/**
|
|
|
|
* Sets the top filmstrip's height.
|
|
|
|
*
|
|
|
|
* @param {number} height - The new height of the filmstrip.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_FILMSTRIP_HEIGHT,
|
|
|
|
* height: number
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setFilmstripHeight(height: number) {
|
|
|
|
return {
|
|
|
|
type: SET_FILMSTRIP_HEIGHT,
|
|
|
|
height
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
/**
|
|
|
|
* Sets the filmstrip's width.
|
|
|
|
*
|
|
|
|
* @param {number} width - The new width of the filmstrip.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_FILMSTRIP_WIDTH,
|
|
|
|
* width: number
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setFilmstripWidth(width: number) {
|
|
|
|
return {
|
|
|
|
type: SET_FILMSTRIP_WIDTH,
|
|
|
|
width
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-06-29 13:59:49 +00:00
|
|
|
/**
|
|
|
|
* Sets the filmstrip's height and the user preferred height.
|
|
|
|
*
|
|
|
|
* @param {number} height - The new height of the filmstrip.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_USER_FILMSTRIP_WIDTH,
|
|
|
|
* height: number
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setUserFilmstripHeight(height: number) {
|
|
|
|
return {
|
|
|
|
type: SET_USER_FILMSTRIP_HEIGHT,
|
|
|
|
height
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-02-24 12:20:37 +00:00
|
|
|
/**
|
|
|
|
* Sets the filmstrip's width and the user preferred width.
|
|
|
|
*
|
|
|
|
* @param {number} width - The new width of the filmstrip.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_USER_FILMSTRIP_WIDTH,
|
|
|
|
* width: number
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setUserFilmstripWidth(width: number) {
|
|
|
|
return {
|
|
|
|
type: SET_USER_FILMSTRIP_WIDTH,
|
|
|
|
width
|
|
|
|
};
|
|
|
|
}
|
2022-03-14 11:11:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether the user is resizing or not.
|
|
|
|
*
|
|
|
|
* @param {boolean} resizing - Whether the user is resizing or not.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function setUserIsResizing(resizing: boolean) {
|
|
|
|
return {
|
|
|
|
type: SET_USER_IS_RESIZING,
|
|
|
|
resizing
|
|
|
|
};
|
|
|
|
}
|
2022-03-29 08:45:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add participant to the active participants list.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The Id of the participant to be added.
|
|
|
|
* @param {boolean?} pinned - Whether the participant is pinned or not.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function addStageParticipant(participantId, pinned = false) {
|
|
|
|
return {
|
|
|
|
type: ADD_STAGE_PARTICIPANT,
|
|
|
|
participantId,
|
|
|
|
pinned
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove participant from the active participants list.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The Id of the participant to be removed.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function removeStageParticipant(participantId) {
|
|
|
|
return {
|
|
|
|
type: REMOVE_STAGE_PARTICIPANT,
|
|
|
|
participantId
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the active participants list.
|
|
|
|
*
|
|
|
|
* @param {Array<Object>} queue - The new list.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function setStageParticipants(queue) {
|
|
|
|
return {
|
|
|
|
type: SET_STAGE_PARTICIPANTS,
|
|
|
|
queue
|
|
|
|
};
|
|
|
|
}
|
2022-04-07 08:31:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the max number of participants to be displayed on stage.
|
|
|
|
*
|
|
|
|
* @param {number} maxParticipants - Max number of participants.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function setMaxStageParticipants(maxParticipants) {
|
|
|
|
return {
|
|
|
|
type: SET_MAX_STAGE_PARTICIPANTS,
|
|
|
|
maxParticipants
|
|
|
|
};
|
|
|
|
}
|
2022-04-12 06:57:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Toggles the pin state of the given participant.
|
|
|
|
*
|
|
|
|
* @param {string} participantId - The id of the participant to be toggled.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function togglePinStageParticipant(participantId) {
|
|
|
|
return {
|
|
|
|
type: TOGGLE_PIN_STAGE_PARTICIPANT,
|
|
|
|
participantId
|
|
|
|
};
|
|
|
|
}
|
2022-04-12 13:19:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the stage participants list.
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function clearStageParticipants() {
|
|
|
|
return {
|
|
|
|
type: CLEAR_STAGE_PARTICIPANTS
|
|
|
|
};
|
|
|
|
}
|
2022-06-29 13:59:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the screensharing tile dimensions.
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function setScreensharingTileDimensions() {
|
|
|
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
|
|
|
const state = getState();
|
|
|
|
const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
|
|
|
|
const { visible, topPanelHeight, topPanelVisible } = state['features/filmstrip'];
|
|
|
|
const verticalWidth = visible ? getVerticalViewMaxWidth(state) : 0;
|
|
|
|
const availableWidth = clientWidth - verticalWidth;
|
|
|
|
const topPanel = isStageFilmstripTopPanel(state) && topPanelVisible;
|
|
|
|
const availableHeight = clientHeight - (topPanel ? topPanelHeight?.current || TOP_FILMSTRIP_HEIGHT : 0);
|
|
|
|
|
|
|
|
dispatch({
|
|
|
|
type: SET_SCREENSHARING_TILE_DIMENSIONS,
|
|
|
|
dimensions: {
|
|
|
|
filmstripHeight: availableHeight,
|
|
|
|
filmstripWidth: availableWidth,
|
|
|
|
thumbnailSize: {
|
|
|
|
width: availableWidth - TILE_HORIZONTAL_MARGIN,
|
|
|
|
height: availableHeight - TILE_VERTICAL_MARGIN
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the visibility of the top panel.
|
|
|
|
*
|
|
|
|
* @param {boolean} visible - Whether it should be visible or not.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function setTopPanelVisible(visible) {
|
|
|
|
return {
|
|
|
|
type: SET_TOP_PANEL_VISIBILITY,
|
|
|
|
visible
|
|
|
|
};
|
|
|
|
}
|