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.

Filmstrip.web.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { Toolbox } from '../../toolbox';
  5. /**
  6. * Implements a React {@link Component} which represents the filmstrip on
  7. * Web/React.
  8. *
  9. * @extends Component
  10. */
  11. class Filmstrip extends Component {
  12. static propTypes = {
  13. /**
  14. * Whether or not the remote videos should be visible. Will toggle
  15. * a class for hiding the videos.
  16. */
  17. _remoteVideosVisible: React.PropTypes.bool,
  18. /**
  19. * Whether or not the toolbox should be displayed within the filmstrip.
  20. */
  21. displayToolbox: React.PropTypes.bool
  22. };
  23. /**
  24. * Implements React's {@link Component#render()}.
  25. *
  26. * @inheritdoc
  27. * @returns {ReactElement}
  28. */
  29. render() {
  30. /**
  31. * Note: Appending of {@code RemoteVideo} views is handled through
  32. * VideoLayout. The views do not get blown away on render() because
  33. * ReactDOMComponent is only aware of the given JSX and not new appended
  34. * DOM. As such, when updateDOMProperties gets called, only attributes
  35. * will get updated without replacing the DOM. If the known DOM gets
  36. * modified, then the views will get blown away.
  37. */
  38. const filmstripClassNames = `filmstrip ${this.props._remoteVideosVisible
  39. ? '' : 'hide-videos'}`;
  40. return (
  41. <div className = { filmstripClassNames }>
  42. { this.props.displayToolbox ? <Toolbox /> : null }
  43. <div
  44. className = 'filmstrip__videos'
  45. id = 'remoteVideos'>
  46. <div
  47. className = 'filmstrip__videos'
  48. id = 'filmstripLocalVideo' />
  49. <div
  50. className = 'filmstrip__videos'
  51. id = 'filmstripRemoteVideos'>
  52. {/**
  53. * This extra video container is needed for scrolling
  54. * thumbnails in Firefox; otherwise, the flex
  55. * thumbnails resize instead of causing overflow.
  56. */}
  57. <div
  58. className = 'remote-videos-container'
  59. id = 'filmstripRemoteVideosContainer' />
  60. </div>
  61. <audio
  62. id = 'userJoined'
  63. preload = 'auto'
  64. src = 'sounds/joined.wav' />
  65. <audio
  66. id = 'userLeft'
  67. preload = 'auto'
  68. src = 'sounds/left.wav' />
  69. </div>
  70. </div>
  71. );
  72. }
  73. }
  74. /**
  75. * Maps (parts of) the Redux state to the associated {@code Filmstrip}'s props.
  76. *
  77. * @param {Object} state - The Redux state.
  78. * @private
  79. * @returns {{
  80. * _remoteVideosVisible: boolean
  81. * }}
  82. */
  83. function _mapStateToProps(state) {
  84. const { remoteVideosVisible } = state['features/filmstrip'];
  85. const { disable1On1Mode } = state['features/base/config'];
  86. return {
  87. _remoteVideosVisible: Boolean(remoteVideosVisible || disable1On1Mode)
  88. };
  89. }
  90. export default connect(_mapStateToProps)(Filmstrip);