jiti-meet/react/features/filmstrip/functions.web.js

62 lines
2.1 KiB
JavaScript
Raw Normal View History

2017-10-13 19:31:05 +00:00
// @flow
import {
getParticipantCountWithFake,
getPinnedParticipant
} from '../base/participants';
2018-06-14 09:14:32 +00:00
import { toState } from '../base/redux';
2017-10-13 19:31:05 +00:00
declare var interfaceConfig: Object;
2018-06-14 09:14:32 +00:00
/**
* Returns true if the filmstrip on mobile is visible, false otherwise.
*
* NOTE: Filmstrip on web behaves differently to mobile, much simpler, but so
* function lies here only for the sake of consistency and to avoid flow errors
* on import.
*
* @param {Object | Function} stateful - The Object or Function that can be
* resolved to a Redux state object with the toState function.
* @returns {boolean}
*/
export function isFilmstripVisible(stateful: Object | Function) {
return toState(stateful)['features/filmstrip'].visible;
}
/**
2017-10-13 19:31:05 +00:00
* Determines whether the remote video thumbnails should be displayed/visible in
* the filmstrip.
*
* @param {Object} state - The full redux state.
2017-10-13 19:31:05 +00:00
* @returns {boolean} - If remote video thumbnails should be displayed/visible
* in the filmstrip, then {@code true}; otherwise, {@code false}.
*/
export function shouldRemoteVideosBeVisible(state: Object) {
2018-06-26 22:56:22 +00:00
if (state['features/invite'].calleeInfoVisible) {
return false;
}
// Include fake participants to derive how many thumbnails are dispalyed,
// as it is assumed all participants, including fake, will be displayed
// in the filmstrip.
const participantCount = getParticipantCountWithFake(state);
2017-10-13 19:31:05 +00:00
let pinnedParticipant;
2017-10-13 19:31:05 +00:00
return Boolean(
participantCount > 2
2017-10-13 19:31:05 +00:00
// Always show the filmstrip when there is another participant to
// show and the filmstrip is hovered, or local video is pinned, or
// the toolbar is displayed.
|| (participantCount > 1
&& (state['features/filmstrip'].hovered
|| state['features/toolbox'].visible
|| ((pinnedParticipant = getPinnedParticipant(state))
2017-10-13 19:31:05 +00:00
&& pinnedParticipant.local)))
2017-10-13 19:31:05 +00:00
|| (typeof interfaceConfig === 'object'
&& interfaceConfig.filmStripOnly)
2017-10-13 19:31:05 +00:00
|| state['features/base/config'].disable1On1Mode);
}