You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Conference.web.js 8.4KB

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