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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. participantId = 'local'
  46. size = { 200 } />
  47. </div>
  48. );
  49. }
  50. /**
  51. * Maps part of the Redux state to the props of this component.
  52. *
  53. * @param {Object} state - The Redux state.
  54. * @param {Props} ownProps - The own props of the component.
  55. * @returns {Props}
  56. */
  57. function _mapStateToProps(state, ownProps) {
  58. return {
  59. videoMuted: ownProps.videoTrack ? ownProps.videoMuted : state['features/base/media'].video.muted,
  60. videoTrack: ownProps.videoTrack || (getLocalVideoTrack(state['features/base/tracks']) || {}).jitsiTrack
  61. };
  62. }
  63. export default connect(_mapStateToProps)(Preview);