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.

Preview.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 signaling the visibility of camera preview.
  9. */
  10. videoMuted: boolean,
  11. /**
  12. * The JitsiLocalTrack to display.
  13. */
  14. videoTrack: ?Object,
  15. };
  16. /**
  17. * Component showing the video preview and device status.
  18. *
  19. * @param {Props} props - The props of the component.
  20. * @returns {ReactElement}
  21. */
  22. function Preview(props: Props) {
  23. const { videoMuted, videoTrack } = props;
  24. if (!videoMuted && videoTrack) {
  25. return (
  26. <div id = 'preview'>
  27. <Video
  28. className = 'flipVideoX'
  29. videoTrack = {{ jitsiTrack: videoTrack }} />
  30. </div>
  31. );
  32. }
  33. return null;
  34. }
  35. /**
  36. * Maps part of the Redux state to the props of this component.
  37. *
  38. * @param {Object} state - The Redux state.
  39. * @param {Props} ownProps - The own props of the component.
  40. * @returns {Props}
  41. */
  42. function _mapStateToProps(state, ownProps) {
  43. return {
  44. videoMuted: ownProps.videoTrack ? ownProps.videoMuted : state['features/base/media'].video.muted,
  45. videoTrack: ownProps.videoTrack || (getLocalVideoTrack(state['features/base/tracks']) || {}).jitsiTrack
  46. };
  47. }
  48. export default connect(_mapStateToProps)(Preview);