Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

VideoQualityLabel.native.tsx 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import React, { Component } from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { connect } from 'react-redux';
  4. import { IReduxState } from '../../app/types';
  5. import { translate } from '../../base/i18n/functions';
  6. import Label from '../../base/label/components/native/Label';
  7. import { StyleType, combineStyles } from '../../base/styles/functions.native';
  8. import styles from './styles';
  9. interface IProps extends WithTranslation {
  10. /**
  11. * Whether or not the conference is in audio only mode.
  12. */
  13. _audioOnly: boolean;
  14. /**
  15. * Style of the component passed as props.
  16. */
  17. style?: StyleType;
  18. }
  19. /**
  20. * React {@code Component} responsible for displaying a label that indicates
  21. * the displayed video state of the current conference.
  22. *
  23. * NOTE: Due to the lack of actual video quality information on mobile side,
  24. * this component currently only displays audio only indicator, but the naming
  25. * is kept consistent with web and in the future we may introduce the required
  26. * api and extend this component with actual quality indication.
  27. */
  28. class VideoQualityLabel extends Component<IProps> {
  29. /**
  30. * Implements React {@link Component}'s render.
  31. *
  32. * @inheritdoc
  33. */
  34. render() {
  35. const { _audioOnly, style, t } = this.props;
  36. if (!_audioOnly) {
  37. // We don't have info about the quality so no need for the indicator
  38. return null;
  39. }
  40. return (
  41. <Label // @ts-ignore
  42. style = { combineStyles(styles.indicatorAudioOnly, style) }
  43. text = { t('videoStatus.audioOnly') } />
  44. );
  45. }
  46. }
  47. /**
  48. * Maps (parts of) the Redux state to the associated
  49. * {@code AbstractVideoQualityLabel}'s props.
  50. *
  51. * @param {Object} state - The Redux state.
  52. * @private
  53. * @returns {{
  54. * _audioOnly: boolean
  55. * }}
  56. */
  57. function _mapStateToProps(state: IReduxState) {
  58. const { enabled: audioOnly } = state['features/base/audio-only'];
  59. return {
  60. _audioOnly: audioOnly
  61. };
  62. }
  63. export default translate(connect(_mapStateToProps)(VideoQualityLabel));