您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

VideoStatusLabel.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import AudioOnlyLabel from './AudioOnlyLabel';
  4. import HDVideoLabel from './HDVideoLabel';
  5. /**
  6. * React {@code Component} responsible for displaying a label that indicates
  7. * the displayed video state of the current conference. {@code AudioOnlyLabel}
  8. * will display when the conference is in audio only mode. {@code HDVideoLabel}
  9. * will display if not in audio only mode and a high-definition large video is
  10. * being displayed.
  11. */
  12. export class VideoStatusLabel extends Component {
  13. /**
  14. * {@code VideoStatusLabel}'s property types.
  15. *
  16. * @static
  17. */
  18. static propTypes = {
  19. /**
  20. * Whether or not the conference is in audio only mode.
  21. */
  22. _audioOnly: React.PropTypes.bool,
  23. /**
  24. * Whether or not a high-definition large video is displayed.
  25. */
  26. _largeVideoHD: React.PropTypes.bool
  27. }
  28. /**
  29. * Implements React's {@link Component#render()}.
  30. *
  31. * @inheritdoc
  32. * @returns {ReactElement|null}
  33. */
  34. render() {
  35. if (this.props._audioOnly) {
  36. return <AudioOnlyLabel />;
  37. } else if (this.props._largeVideoHD) {
  38. return <HDVideoLabel />;
  39. }
  40. return null;
  41. }
  42. }
  43. /**
  44. * Maps (parts of) the Redux state to the associated {@code VideoStatusLabel}'s
  45. * props.
  46. *
  47. * @param {Object} state - The Redux state.
  48. * @private
  49. * @returns {{
  50. * _audioOnly: boolean,
  51. * _largeVideoHD: boolean
  52. * }}
  53. */
  54. function _mapStateToProps(state) {
  55. const { audioOnly, isLargeVideoHD } = state['features/base/conference'];
  56. return {
  57. _audioOnly: audioOnly,
  58. _largeVideoHD: isLargeVideoHD
  59. };
  60. }
  61. export default connect(_mapStateToProps)(VideoStatusLabel);