Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

Preview.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // @flow
  2. import React from 'react';
  3. import { Video } from '../../../media';
  4. import { connect } from '../../../redux';
  5. import { getLocalVideoTrack } from '../../../tracks';
  6. export type Props = {
  7. /**
  8. * Flag controlling whether the video should be flipped or not.
  9. */
  10. flipVideo: boolean,
  11. /**
  12. * Flag signaling the visibility of camera preview.
  13. */
  14. videoMuted: boolean,
  15. /**
  16. * The JitsiLocalTrack to display.
  17. */
  18. videoTrack: ?Object,
  19. };
  20. /**
  21. * Component showing the video preview and device status.
  22. *
  23. * @param {Props} props - The props of the component.
  24. * @returns {ReactElement}
  25. */
  26. function Preview(props: Props) {
  27. const { videoMuted, videoTrack, flipVideo } = props;
  28. const className = flipVideo ? 'flipVideoX' : '';
  29. if (!videoMuted && videoTrack) {
  30. return (
  31. <div id = 'preview'>
  32. <Video
  33. className = { className }
  34. videoTrack = {{ jitsiTrack: videoTrack }} />
  35. </div>
  36. );
  37. }
  38. return null;
  39. }
  40. /**
  41. * Maps part of the Redux state to the props of this component.
  42. *
  43. * @param {Object} state - The Redux state.
  44. * @param {Props} ownProps - The own props of the component.
  45. * @returns {Props}
  46. */
  47. function _mapStateToProps(state, ownProps) {
  48. return {
  49. flipVideo: state['features/base/settings'].localFlipX,
  50. videoMuted: ownProps.videoTrack ? ownProps.videoMuted : state['features/base/media'].video.muted,
  51. videoTrack: ownProps.videoTrack || (getLocalVideoTrack(state['features/base/tracks']) || {}).jitsiTrack
  52. };
  53. }
  54. export default connect(_mapStateToProps)(Preview);