You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.native.js 1.3KB

123456789101112131415161718192021222324252627282930313233
  1. // @flow
  2. import { hasAvailableDevices } from '../base/devices';
  3. import { TOOLBOX_ALWAYS_VISIBLE, getFeatureFlag, TOOLBOX_ENABLED } from '../base/flags';
  4. import { toState } from '../base/redux';
  5. import { isLocalVideoTrackDesktop } from '../base/tracks';
  6. /**
  7. * Returns true if the toolbox is visible.
  8. *
  9. * @param {Object | Function} stateful - A function or object that can be
  10. * resolved to Redux state by the function {@code toState}.
  11. * @returns {boolean}
  12. */
  13. export function isToolboxVisible(stateful: Object | Function) {
  14. const state = toState(stateful);
  15. const { alwaysVisible, enabled, visible } = state['features/toolbox'];
  16. const { length: participantCount } = state['features/base/participants'];
  17. const alwaysVisibleFlag = getFeatureFlag(state, TOOLBOX_ALWAYS_VISIBLE, false);
  18. const enabledFlag = getFeatureFlag(state, TOOLBOX_ENABLED, true);
  19. return enabledFlag && enabled && (alwaysVisible || visible || participantCount === 1 || alwaysVisibleFlag);
  20. }
  21. /**
  22. * Indicates if the video mute button is disabled or not.
  23. *
  24. * @param {string} state - The state from the Redux store.
  25. * @returns {boolean}
  26. */
  27. export function isVideoMuteButtonDisabled(state: Object) {
  28. return !hasAvailableDevices(state, 'videoInput') || isLocalVideoTrackDesktop(state);
  29. }