Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

LargeVideo.web.js 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { Watermarks } from '../../base/react';
  4. import { connect } from '../../base/redux';
  5. import { setColorAlpha } from '../../base/util';
  6. import { fetchCustomBrandingData } from '../../dynamic-branding';
  7. import { Captions } from '../../subtitles/';
  8. declare var interfaceConfig: Object;
  9. type Props = {
  10. /**
  11. * The alpha(opacity) of the background
  12. */
  13. _backgroundAlpha: number,
  14. /**
  15. * The user selected background color.
  16. */
  17. _customBackgroundColor: string,
  18. /**
  19. * The user selected background image url.
  20. */
  21. _customBackgroundImageUrl: string,
  22. /**
  23. * Fetches the branding data.
  24. */
  25. _fetchCustomBrandingData: Function,
  26. /**
  27. * Prop that indicates whether the chat is open.
  28. */
  29. _isChatOpen: boolean,
  30. /**
  31. * Used to determine the value of the autoplay attribute of the underlying
  32. * video element.
  33. */
  34. _noAutoPlayVideo: boolean
  35. }
  36. /**
  37. * Implements a React {@link Component} which represents the large video (a.k.a.
  38. * the conference participant who is on the local stage) on Web/React.
  39. *
  40. * @extends Component
  41. */
  42. class LargeVideo extends Component<Props> {
  43. /**
  44. * Implements React's {@link Component#componentDidMount}.
  45. *
  46. * @inheritdoc
  47. */
  48. componentDidMount() {
  49. this.props._fetchCustomBrandingData();
  50. }
  51. /**
  52. * Implements React's {@link Component#render()}.
  53. *
  54. * @inheritdoc
  55. * @returns {React$Element}
  56. */
  57. render() {
  58. const style = this._getCustomSyles();
  59. const className = `videocontainer${this.props._isChatOpen ? ' shift-right' : ''}`;
  60. return (
  61. <div
  62. className = { className }
  63. id = 'largeVideoContainer'
  64. style = { style }>
  65. <div id = 'sharedVideo'>
  66. <div id = 'sharedVideoIFrame' />
  67. </div>
  68. <div id = 'etherpad' />
  69. <Watermarks />
  70. <div id = 'dominantSpeaker'>
  71. <div className = 'dynamic-shadow' />
  72. <div id = 'dominantSpeakerAvatarContainer' />
  73. </div>
  74. <div id = 'remotePresenceMessage' />
  75. <span id = 'remoteConnectionMessage' />
  76. <div id = 'largeVideoElementsContainer'>
  77. <div id = 'largeVideoBackgroundContainer' />
  78. {/*
  79. * FIXME: the architecture of elements related to the large
  80. * video and the naming. The background is not part of
  81. * largeVideoWrapper because we are controlling the size of
  82. * the video through largeVideoWrapper. That's why we need
  83. * another container for the background and the
  84. * largeVideoWrapper in order to hide/show them.
  85. */}
  86. <div id = 'largeVideoWrapper'>
  87. <video
  88. autoPlay = { !this.props._noAutoPlayVideo }
  89. id = 'largeVideo'
  90. muted = { true }
  91. playsInline = { true } /* for Safari on iOS to work */ />
  92. </div>
  93. </div>
  94. { interfaceConfig.DISABLE_TRANSCRIPTION_SUBTITLES
  95. || <Captions /> }
  96. </div>
  97. );
  98. }
  99. /**
  100. * Creates the custom styles object.
  101. *
  102. * @private
  103. * @returns {Object}
  104. */
  105. _getCustomSyles() {
  106. const styles = {};
  107. const { _customBackgroundColor, _customBackgroundImageUrl } = this.props;
  108. styles.backgroundColor = _customBackgroundColor || interfaceConfig.DEFAULT_BACKGROUND;
  109. if (this.props._backgroundAlpha !== undefined) {
  110. const alphaColor = setColorAlpha(styles.backgroundColor, this.props._backgroundAlpha);
  111. styles.backgroundColor = alphaColor;
  112. }
  113. if (_customBackgroundImageUrl) {
  114. styles.backgroundImage = `url(${_customBackgroundImageUrl})`;
  115. styles.backgroundSize = 'cover';
  116. }
  117. return styles;
  118. }
  119. }
  120. /**
  121. * Maps (parts of) the Redux state to the associated LargeVideo props.
  122. *
  123. * @param {Object} state - The Redux state.
  124. * @private
  125. * @returns {Props}
  126. */
  127. function _mapStateToProps(state) {
  128. const testingConfig = state['features/base/config'].testing;
  129. const { backgroundColor, backgroundImageUrl } = state['features/dynamic-branding'];
  130. const { isOpen: isChatOpen } = state['features/chat'];
  131. return {
  132. _backgroundAlpha: state['features/base/config'].backgroundAlpha,
  133. _customBackgroundColor: backgroundColor,
  134. _customBackgroundImageUrl: backgroundImageUrl,
  135. _isChatOpen: isChatOpen,
  136. _noAutoPlayVideo: testingConfig?.noAutoPlayVideo
  137. };
  138. }
  139. const _mapDispatchToProps = {
  140. _fetchCustomBrandingData: fetchCustomBrandingData
  141. };
  142. export default connect(_mapStateToProps, _mapDispatchToProps)(LargeVideo);