Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

OverflowMenuVideoQualityItem.web.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { VIDEO_QUALITY_LEVELS } from '../../base/conference';
  4. import { translate } from '../../base/i18n';
  5. import {
  6. Icon,
  7. IconVideoQualityAudioOnly,
  8. IconVideoQualityHD,
  9. IconVideoQualityLD,
  10. IconVideoQualitySD
  11. } from '../../base/icons';
  12. import { connect } from '../../base/redux';
  13. /**
  14. * A map of of selectable receive resolutions to corresponding icons.
  15. *
  16. * @private
  17. * @type {Object}
  18. */
  19. const VIDEO_QUALITY_TO_ICON = {
  20. [VIDEO_QUALITY_LEVELS.HIGH]: IconVideoQualityHD,
  21. [VIDEO_QUALITY_LEVELS.STANDARD]: IconVideoQualitySD,
  22. [VIDEO_QUALITY_LEVELS.LOW]: IconVideoQualityLD
  23. };
  24. /**
  25. * The type of the React {@code Component} props of
  26. * {@link OverflowMenuVideoQualityItem}.
  27. */
  28. type Props = {
  29. /**
  30. * Whether or not audio only mode is currently enabled.
  31. */
  32. _audioOnly: boolean,
  33. /**
  34. * The currently configured maximum quality resolution to be received from
  35. * remote participants.
  36. */
  37. _receiverVideoQuality: number,
  38. /**
  39. * Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked.
  40. */
  41. onClick: Function,
  42. /**
  43. * Invoked to obtain translated strings.
  44. */
  45. t: Function
  46. };
  47. /**
  48. * React {@code Component} responsible for displaying a button in the overflow
  49. * menu of the toolbar, including an icon showing the currently selected
  50. * max receive quality.
  51. *
  52. * @extends Component
  53. */
  54. class OverflowMenuVideoQualityItem extends Component<Props> {
  55. /**
  56. * Implements React's {@link Component#render()}.
  57. *
  58. * @inheritdoc
  59. * @returns {ReactElement}
  60. */
  61. render() {
  62. const { _audioOnly, _receiverVideoQuality } = this.props;
  63. const icon = _audioOnly || !_receiverVideoQuality
  64. ? IconVideoQualityAudioOnly
  65. : VIDEO_QUALITY_TO_ICON[_receiverVideoQuality];
  66. return (
  67. <li
  68. aria-label =
  69. { this.props.t('toolbar.accessibilityLabel.callQuality') }
  70. className = 'overflow-menu-item'
  71. onClick = { this.props.onClick }>
  72. <span className = 'overflow-menu-item-icon'>
  73. <Icon src = { icon } />
  74. </span>
  75. <span className = 'profile-text'>
  76. { this.props.t('toolbar.callQuality') }
  77. </span>
  78. </li>
  79. );
  80. }
  81. }
  82. /**
  83. * Maps (parts of) the Redux state to the associated props for the
  84. * {@code OverflowMenuVideoQualityItem} component.
  85. *
  86. * @param {Object} state - The Redux state.
  87. * @private
  88. * @returns {{
  89. * _audioOnly: boolean,
  90. * _receiverVideoQuality: number
  91. * }}
  92. */
  93. function _mapStateToProps(state) {
  94. return {
  95. _audioOnly: state['features/base/audio-only'].enabled,
  96. _receiverVideoQuality:
  97. state['features/base/conference'].preferredReceiverVideoQuality
  98. };
  99. }
  100. export default translate(
  101. connect(_mapStateToProps)(OverflowMenuVideoQualityItem));