您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

functions.native.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @flow
  2. import { getFeatureFlag, FILMSTRIP_ENABLED } from '../base/flags';
  3. import { getParticipantCountWithFake, getPinnedParticipant } from '../base/participants';
  4. import { toState } from '../base/redux';
  5. export * from './functions.any';
  6. /**
  7. * Returns true if the filmstrip on mobile is visible, false otherwise.
  8. *
  9. * NOTE: Filmstrip on mobile behaves differently to web, and is only visible
  10. * when there are at least 2 participants.
  11. *
  12. * @param {Object | Function} stateful - The Object or Function that can be
  13. * resolved to a Redux state object with the toState function.
  14. * @returns {boolean}
  15. */
  16. export function isFilmstripVisible(stateful: Object | Function) {
  17. const state = toState(stateful);
  18. const enabled = getFeatureFlag(state, FILMSTRIP_ENABLED, true);
  19. if (!enabled) {
  20. return false;
  21. }
  22. return getParticipantCountWithFake(state) > 1;
  23. }
  24. /**
  25. * Determines whether the remote video thumbnails should be displayed/visible in
  26. * the filmstrip.
  27. *
  28. * @param {Object} state - The full redux state.
  29. * @returns {boolean} - If remote video thumbnails should be displayed/visible
  30. * in the filmstrip, then {@code true}; otherwise, {@code false}.
  31. */
  32. export function shouldRemoteVideosBeVisible(state: Object) {
  33. if (state['features/invite'].calleeInfoVisible) {
  34. return false;
  35. }
  36. // Include fake participants to derive how many thumbnails are dispalyed,
  37. // as it is assumed all participants, including fake, will be displayed
  38. // in the filmstrip.
  39. const participantCount = getParticipantCountWithFake(state);
  40. const pinnedParticipant = getPinnedParticipant(state);
  41. const { disable1On1Mode } = state['features/base/config'];
  42. return Boolean(
  43. participantCount > 2
  44. // Always show the filmstrip when there is another participant to
  45. // show and the local video is pinned. Note we are not taking the
  46. // toolbar visibility into account here (unlike web) because
  47. // showing / hiding views in quick succession on mobile is taxing.
  48. || (participantCount > 1 && pinnedParticipant?.local)
  49. || disable1On1Mode);
  50. }