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

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