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.3KB

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