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, getPrejoinName, 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. <Video
  38. className = 'flipVideoX prejoin-preview-video'
  39. videoTrack = {{ jitsiTrack: videoTrack }} />
  40. </div>
  41. );
  42. }
  43. return (
  44. <div className = 'prejoin-preview prejoin-preview--no-video'>
  45. <Avatar
  46. className = 'prejoin-preview-avatar'
  47. displayName = { name }
  48. size = { 200 } />
  49. </div>
  50. );
  51. }
  52. /**
  53. * Maps the redux state to the React {@code Component} props.
  54. *
  55. * @param {Object} state - The redux state.
  56. * @returns {Object}
  57. */
  58. function mapStateToProps(state) {
  59. return {
  60. name: getPrejoinName(state),
  61. videoTrack: getActiveVideoTrack(state),
  62. showCameraPreview: !isPrejoinVideoMuted(state)
  63. };
  64. }
  65. export default connect(mapStateToProps)(Preview);