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.1KB

1234567891011121314151617181920212223242526272829303132
  1. // @flow
  2. import { hasAvailableDevices } from '../base/devices';
  3. import { TOOLBOX_ALWAYS_VISIBLE, getFeatureFlag } 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 flag = getFeatureFlag(state, TOOLBOX_ALWAYS_VISIBLE, false);
  18. return enabled && (alwaysVisible || visible || participantCount === 1 || flag);
  19. }
  20. /**
  21. * Indicates if the video mute button is disabled or not.
  22. *
  23. * @param {string} state - The state from the Redux store.
  24. * @returns {boolean}
  25. */
  26. export function isVideoMuteButtonDisabled(state: Object) {
  27. return !hasAvailableDevices(state, 'videoInput') || isLocalVideoTrackDesktop(state);
  28. }