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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // @flow
  2. import React from 'react';
  3. import { Avatar } from '../../../base/avatar';
  4. import { Video } from '../../../base/media';
  5. import { connect } from '../../../base/redux';
  6. import { getActiveVideoTrack, isPrejoinVideoMuted } from '../../functions';
  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. showCameraPreview: 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 {
  29. name,
  30. showCameraPreview,
  31. videoTrack
  32. } = props;
  33. if (showCameraPreview && videoTrack) {
  34. return (
  35. <div className = 'prejoin-preview'>
  36. <div className = 'prejoin-preview-overlay' />
  37. <div className = 'prejoin-preview-bottom-overlay' />
  38. <Video
  39. className = 'flipVideoX prejoin-preview-video'
  40. videoTrack = {{ jitsiTrack: videoTrack }} />
  41. </div>
  42. );
  43. }
  44. return (
  45. <div className = 'prejoin-preview prejoin-preview--no-video'>
  46. <Avatar
  47. className = 'prejoin-preview-avatar'
  48. displayName = { name }
  49. size = { 200 } />
  50. </div>
  51. );
  52. }
  53. /**
  54. * Maps the redux state to the React {@code Component} props.
  55. *
  56. * @param {Object} state - The redux state.
  57. * @returns {Object}
  58. */
  59. function mapStateToProps(state) {
  60. return {
  61. videoTrack: getActiveVideoTrack(state),
  62. showCameraPreview: !isPrejoinVideoMuted(state)
  63. };
  64. }
  65. export default connect(mapStateToProps)(Preview);