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.

LargeVideo.web.js 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { Watermarks } from '../../base/react';
  4. import { connect } from '../../base/redux';
  5. import { 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. <div id = 'sharedVideo'>
  63. <div id = 'sharedVideoIFrame' />
  64. </div>
  65. <div id = 'etherpad' />
  66. <Watermarks />
  67. <div id = 'dominantSpeaker'>
  68. <div className = 'dynamic-shadow' />
  69. <div id = 'dominantSpeakerAvatarContainer' />
  70. </div>
  71. <div id = 'remotePresenceMessage' />
  72. <span id = 'remoteConnectionMessage' />
  73. <div id = 'largeVideoElementsContainer'>
  74. <div id = 'largeVideoBackgroundContainer' />
  75. {/*
  76. * FIXME: the architecture of elements related to the large
  77. * video and the naming. The background is not part of
  78. * largeVideoWrapper because we are controlling the size of
  79. * the video through largeVideoWrapper. That's why we need
  80. * another container for the background and the
  81. * largeVideoWrapper in order to hide/show them.
  82. */}
  83. <div id = 'largeVideoWrapper'>
  84. <video
  85. autoPlay = { !this.props._noAutoPlayVideo }
  86. id = 'largeVideo'
  87. muted = { true }
  88. playsInline = { true } /* for Safari on iOS to work */ />
  89. </div>
  90. </div>
  91. { interfaceConfig.DISABLE_TRANSCRIPTION_SUBTITLES
  92. || <Captions /> }
  93. </div>
  94. );
  95. }
  96. /**
  97. * Creates the custom styles object.
  98. *
  99. * @private
  100. * @returns {Object}
  101. */
  102. _getCustomSyles() {
  103. const styles = {};
  104. const { _customBackgroundColor, _customBackgroundImageUrl } = this.props;
  105. styles.backgroundColor = _customBackgroundColor || interfaceConfig.DEFAULT_BACKGROUND;
  106. if (_customBackgroundImageUrl) {
  107. styles.backgroundImage = `url(${_customBackgroundImageUrl})`;
  108. styles.backgroundSize = 'cover';
  109. }
  110. return styles;
  111. }
  112. }
  113. /**
  114. * Maps (parts of) the Redux state to the associated LargeVideo props.
  115. *
  116. * @param {Object} state - The Redux state.
  117. * @private
  118. * @returns {Props}
  119. */
  120. function _mapStateToProps(state) {
  121. const testingConfig = state['features/base/config'].testing;
  122. const { backgroundColor, backgroundImageUrl } = state['features/dynamic-branding'];
  123. const { isOpen: isChatOpen } = state['features/chat'];
  124. return {
  125. _customBackgroundColor: backgroundColor,
  126. _customBackgroundImageUrl: backgroundImageUrl,
  127. _isChatOpen: isChatOpen,
  128. _noAutoPlayVideo: testingConfig?.noAutoPlayVideo
  129. };
  130. }
  131. const _mapDispatchToProps = {
  132. _fetchCustomBrandingData: fetchCustomBrandingData
  133. };
  134. export default connect(_mapStateToProps, _mapDispatchToProps)(LargeVideo);