Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

VideoInputPreview.web.tsx 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import React from 'react';
  2. import { makeStyles } from 'tss-react/mui';
  3. import { Video } from '../../base/media/components/index';
  4. /**
  5. * The type of the React {@code Component} props of {@link VideoInputPreview}.
  6. */
  7. interface IProps {
  8. /**
  9. * An error message to display instead of a preview. Displaying an error
  10. * will take priority over displaying a video preview.
  11. */
  12. error: string | null;
  13. /**
  14. * Whether or not the local video is flipped.
  15. */
  16. localFlipX: boolean;
  17. /**
  18. * The JitsiLocalTrack to display.
  19. */
  20. track: Object;
  21. }
  22. const useStyles = makeStyles()(theme => {
  23. return {
  24. container: {
  25. position: 'relative',
  26. borderRadius: '3px',
  27. overflow: 'hidden',
  28. marginBottom: theme.spacing(4),
  29. backgroundColor: theme.palette.uiBackground
  30. },
  31. video: {
  32. height: 'auto',
  33. width: '100%',
  34. overflow: 'hidden'
  35. },
  36. errorText: {
  37. color: theme.palette.text01,
  38. left: 0,
  39. position: 'absolute',
  40. right: 0,
  41. textAlign: 'center',
  42. top: '50%'
  43. }
  44. };
  45. });
  46. const VideoInputPreview = ({ error, localFlipX, track }: IProps) => {
  47. const { classes, cx } = useStyles();
  48. return (
  49. <div className = { classes.container }>
  50. <Video
  51. className = { cx(classes.video, localFlipX && 'flipVideoX') }
  52. playsinline = { true }
  53. videoTrack = {{ jitsiTrack: track }} />
  54. {error && (
  55. <div className = { classes.errorText }>
  56. {error}
  57. </div>
  58. )}
  59. </div>
  60. );
  61. };
  62. export default VideoInputPreview;