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

LargeVideo.web.js 4.7KB

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