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.

ScreenSharingAndroidButton.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // @flow
  2. import { translate } from '../../../base/i18n';
  3. import { IconShareDesktop } from '../../../base/icons';
  4. import { connect } from '../../../base/redux';
  5. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  6. import { toggleScreensharing, isLocalVideoTrackDesktop } from '../../../base/tracks';
  7. /**
  8. * The type of the React {@code Component} props of {@link ScreenSharingAndroidButton}.
  9. */
  10. type Props = AbstractButtonProps & {
  11. /**
  12. * Whether video is currently muted or not.
  13. */
  14. _screensharing: boolean,
  15. /**
  16. * The redux {@code dispatch} function.
  17. */
  18. dispatch: Function
  19. };
  20. /**
  21. * An implementation of a button for toggling screen sharing.
  22. */
  23. class ScreenSharingAndroidButton extends AbstractButton<Props, *> {
  24. accessibilityLabel = 'toolbar.accessibilityLabel.shareYourScreen';
  25. icon = IconShareDesktop;
  26. label = 'toolbar.startScreenSharing';
  27. toggledLabel = 'toolbar.stopScreenSharing';
  28. /**
  29. * Handles clicking / pressing the button.
  30. *
  31. * @override
  32. * @protected
  33. * @returns {void}
  34. */
  35. _handleClick() {
  36. this.props.dispatch(toggleScreensharing());
  37. }
  38. /**
  39. * Indicates whether this button is in toggled state or not.
  40. *
  41. * @override
  42. * @protected
  43. * @returns {boolean}
  44. */
  45. _isToggled() {
  46. return this.props._screensharing;
  47. }
  48. }
  49. /**
  50. * Maps (parts of) the redux state to the associated props for the
  51. * {@code ToggleCameraButton} component.
  52. *
  53. * @param {Object} state - The Redux state.
  54. * @private
  55. * @returns {{
  56. * _disabled: boolean,
  57. * _screensharing: boolean
  58. * }}
  59. */
  60. function _mapStateToProps(state): Object {
  61. return {
  62. _screensharing: isLocalVideoTrackDesktop(state)
  63. };
  64. }
  65. export default translate(connect(_mapStateToProps)(ScreenSharingAndroidButton));