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

Conference.web.js 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /* global $, APP, interfaceConfig */
  2. import React, { Component } from 'react';
  3. import { connect as reactReduxConnect } from 'react-redux';
  4. import { connect, disconnect } from '../../base/connection';
  5. /**
  6. * For legacy reasons, inline style for display none.
  7. * @type {{display: string}}
  8. */
  9. const DISPLAY_NONE_STYLE = {
  10. display: 'none'
  11. };
  12. /**
  13. * Implements a React Component which renders initial conference layout
  14. */
  15. class Conference extends Component {
  16. /**
  17. * Conference component's property types.
  18. *
  19. * @static
  20. */
  21. static propTypes = {
  22. dispatch: React.PropTypes.func
  23. }
  24. /**
  25. * Until we don't rewrite UI using react components
  26. * we use UI.start from old app. Also method translates
  27. * component right after it has been mounted.
  28. *
  29. * @inheritdoc
  30. */
  31. componentDidMount() {
  32. APP.UI.start();
  33. // XXX Temporary solution until we add React translation.
  34. APP.translation.translateElement($('#videoconference_page'));
  35. this.props.dispatch(connect());
  36. }
  37. /**
  38. * Disconnect from the conference when component will be
  39. * unmounted.
  40. *
  41. * @inheritdoc
  42. */
  43. componentWillUnmount() {
  44. this.props.dispatch(disconnect());
  45. }
  46. /**
  47. * Initializes Conference component instance.
  48. *
  49. * @param {Object} props - The read-only properties with which the new
  50. * instance is to be initialized.
  51. */
  52. constructor(props) {
  53. super(props);
  54. const showBrandWatermark = interfaceConfig.SHOW_BRAND_WATERMARK;
  55. const showJitsiWatermark = interfaceConfig.SHOW_JITSI_WATERMARK;
  56. const showJitsiWatermarkForGuest
  57. = interfaceConfig.SHOW_WATERMARK_FOR_GUESTS;
  58. this.state = {
  59. ...this.state,
  60. showBrandWatermark,
  61. showJitsiWatermark,
  62. showJitsiWatermarkForGuest,
  63. brandWatermarkLink:
  64. showBrandWatermark ? interfaceConfig.BRAND_WATERMARK_LINK : '',
  65. jitsiWatermarkLink:
  66. showJitsiWatermark || showJitsiWatermarkForGuest
  67. ? interfaceConfig.JITSI_WATERMARK_LINK : '',
  68. showPoweredBy: interfaceConfig.SHOW_POWERED_BY
  69. };
  70. }
  71. /**
  72. * Implements React's {@link Component#render()}.
  73. *
  74. * @inheritdoc
  75. * @returns {ReactElement}
  76. */
  77. render() {
  78. return (
  79. <div id = 'videoconference_page'>
  80. <div id = 'mainToolbarContainer'>
  81. <div
  82. className = 'notice'
  83. id = 'notice'
  84. style = { DISPLAY_NONE_STYLE }>
  85. <span
  86. className = 'noticeText'
  87. id = 'noticeText' />
  88. </div>
  89. <div
  90. className = 'toolbar'
  91. id = 'mainToolbar' />
  92. </div>
  93. <div
  94. className = 'hide'
  95. id = 'subject' />
  96. <div
  97. className = 'toolbar'
  98. id = 'extendedToolbar'>
  99. <div id = 'extendedToolbarButtons' />
  100. <a
  101. className = 'button icon-feedback'
  102. id = 'feedbackButton' />
  103. <div id = 'sideToolbarContainer' />
  104. </div>
  105. <div id = 'videospace'>
  106. <div
  107. className = 'videocontainer'
  108. id = 'largeVideoContainer'>
  109. <div id = 'sharedVideo'>
  110. <div id = 'sharedVideoIFrame' />
  111. </div>
  112. <div id = 'etherpad' />
  113. {
  114. this._renderJitsiWatermark()
  115. }
  116. {
  117. this._renderBrandWatermark()
  118. }
  119. {
  120. this._renderPoweredBy()
  121. }
  122. <div id = 'dominantSpeaker'>
  123. <div className = 'dynamic-shadow' />
  124. <img
  125. id = 'dominantSpeakerAvatar'
  126. src = '' />
  127. </div>
  128. <span id = 'remoteConnectionMessage' />
  129. <div id = 'largeVideoWrapper'>
  130. <video
  131. autoPlay = { true }
  132. id = 'largeVideo'
  133. muted = 'true' />
  134. </div>
  135. <span id = 'localConnectionMessage' />
  136. <span
  137. className = 'video-state-indicator moveToCorner'
  138. id = 'videoResolutionLabel'>HD</span>
  139. <span
  140. className
  141. = 'video-state-indicator centeredVideoLabel'
  142. id = 'recordingLabel'>
  143. <span id = 'recordingLabelText' />
  144. <img
  145. className = 'recordingSpinner'
  146. id = 'recordingSpinner'
  147. src = 'images/spin.svg' />
  148. </span>
  149. </div>
  150. <div className = 'filmstrip'>
  151. <div
  152. className = 'filmstrip__videos'
  153. id = 'remoteVideos'>
  154. <span
  155. className = 'videocontainer'
  156. id = 'localVideoContainer'>
  157. <div
  158. className = 'videocontainer__background' />
  159. <span id = 'localVideoWrapper' />
  160. <audio
  161. autoPlay = { true }
  162. id = 'localAudio'
  163. muted = { true } />
  164. <div className = 'videocontainer__toolbar' />
  165. <div
  166. className = 'videocontainer__toptoolbar' />
  167. <div
  168. className
  169. = 'videocontainer__hoverOverlay' />
  170. </span>
  171. <audio
  172. id = 'userJoined'
  173. preload = 'auto'
  174. src = 'sounds/joined.wav' />
  175. <audio
  176. id = 'userLeft'
  177. preload = 'auto'
  178. src = 'sounds/left.wav' />
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. );
  184. }
  185. /**
  186. * Method that returns brand watermark element if it is enabled.
  187. *
  188. * @returns {ReactElement|null}
  189. * @private
  190. */
  191. _renderBrandWatermark() {
  192. if (this.state.showBrandWatermark) {
  193. return (
  194. <a
  195. href = { this.state.brandWatermarkLink }
  196. target = '_new'>
  197. <div className = 'watermark rightwatermark' />
  198. </a>
  199. );
  200. }
  201. return null;
  202. }
  203. /**
  204. * Method that returns jitsi watermark element if it is enabled.
  205. *
  206. * @returns {ReactElement|null}
  207. * @private
  208. */
  209. _renderJitsiWatermark() {
  210. if (this.state.showJitsiWatermark
  211. || (APP.tokenData.isGuest
  212. && this.state.showJitsiWatermarkForGuest)) {
  213. return (
  214. <a
  215. href = { this.state.jitsiWatermarkLink }
  216. target = '_new'>
  217. <div className = 'watermark leftwatermark' />
  218. </a>
  219. );
  220. }
  221. return null;
  222. }
  223. /**
  224. * Renders powered by block if it is enabled.
  225. *
  226. * @returns {ReactElement|null}
  227. * @private
  228. */
  229. _renderPoweredBy() {
  230. if (this.state.showPoweredBy) {
  231. return (
  232. <a
  233. className = 'poweredby hide'
  234. href = 'http://jitsi.org'
  235. target = '_new'>
  236. <span data-i18n = 'poweredby' /> jitsi.org
  237. </a>
  238. );
  239. }
  240. return null;
  241. }
  242. }
  243. export default reactReduxConnect()(Conference);