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

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