Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Filmstrip.web.js 3.1KB

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