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

Conference.web.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* @flow */
  2. import _ from 'lodash';
  3. import PropTypes from 'prop-types';
  4. import React, { Component } from 'react';
  5. import { connect as reactReduxConnect } from 'react-redux';
  6. import { connect, disconnect } from '../../base/connection';
  7. import { DialogContainer } from '../../base/dialog';
  8. import { Filmstrip } from '../../filmstrip';
  9. import { LargeVideo } from '../../large-video';
  10. import { NotificationsContainer } from '../../notifications';
  11. import { OverlayContainer } from '../../overlay';
  12. import { showToolbox, Toolbox } from '../../toolbox';
  13. import { HideNotificationBarStyle } from '../../unsupported-browser';
  14. declare var $: Function;
  15. declare var APP: Object;
  16. declare var interfaceConfig: Object;
  17. /**
  18. * The conference page of the Web application.
  19. */
  20. class Conference extends Component<*> {
  21. _onShowToolbar: Function;
  22. _originalOnShowToolbar: Function;
  23. /**
  24. * Conference component's property types.
  25. *
  26. * @static
  27. */
  28. static propTypes = {
  29. dispatch: PropTypes.func
  30. };
  31. /**
  32. * Initializes a new Conference instance.
  33. *
  34. * @param {Object} props - The read-only properties with which the new
  35. * instance is to be initialized.
  36. */
  37. constructor(props) {
  38. super(props);
  39. // Throttle and bind this component's mousemove handler to prevent it
  40. // from firing too often.
  41. this._originalOnShowToolbar = this._onShowToolbar;
  42. this._onShowToolbar = _.throttle(
  43. () => this._originalOnShowToolbar(),
  44. 100,
  45. {
  46. leading: true,
  47. trailing: false
  48. });
  49. }
  50. /**
  51. * Until we don't rewrite UI using react components
  52. * we use UI.start from old app. Also method translates
  53. * component right after it has been mounted.
  54. *
  55. * @inheritdoc
  56. */
  57. componentDidMount() {
  58. APP.UI.start();
  59. APP.UI.registerListeners();
  60. APP.UI.bindEvents();
  61. this.props.dispatch(connect());
  62. }
  63. /**
  64. * Disconnect from the conference when component will be
  65. * unmounted.
  66. *
  67. * @inheritdoc
  68. */
  69. componentWillUnmount() {
  70. APP.UI.stopDaemons();
  71. APP.UI.unregisterListeners();
  72. APP.UI.unbindEvents();
  73. APP.conference.isJoined() && this.props.dispatch(disconnect());
  74. }
  75. /**
  76. * Implements React's {@link Component#render()}.
  77. *
  78. * @inheritdoc
  79. * @returns {ReactElement}
  80. */
  81. render() {
  82. const { filmStripOnly } = interfaceConfig;
  83. return (
  84. <div
  85. id = 'videoconference_page'
  86. onMouseMove = { this._onShowToolbar }>
  87. <div id = 'videospace'>
  88. <LargeVideo />
  89. <Filmstrip filmstripOnly = { filmStripOnly } />
  90. </div>
  91. { filmStripOnly ? null : <Toolbox /> }
  92. <DialogContainer />
  93. <NotificationsContainer />
  94. <OverlayContainer />
  95. {/*
  96. * Temasys automatically injects a notification bar, if
  97. * necessary, displayed at the top of the page notifying that
  98. * WebRTC is not installed or supported. We do not need/want
  99. * the notification bar in question because we have whole pages
  100. * dedicated to the respective scenarios.
  101. */}
  102. <HideNotificationBarStyle />
  103. </div>
  104. );
  105. }
  106. /**
  107. * Displays the toolbar.
  108. *
  109. * @private
  110. * @returns {void}
  111. */
  112. _onShowToolbar() {
  113. this.props.dispatch(showToolbox());
  114. }
  115. }
  116. export default reactReduxConnect()(Conference);