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.

VideoInputPreview.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { Video } from '../../base/media';
  4. const VIDEO_ERROR_CLASS = 'video-preview-has-error';
  5. /**
  6. * The type of the React {@code Component} props of {@link VideoInputPreview}.
  7. */
  8. type Props = {
  9. /**
  10. * An error message to display instead of a preview. Displaying an error
  11. * will take priority over displaying a video preview.
  12. */
  13. error: string,
  14. /**
  15. * The JitsiLocalTrack to display.
  16. */
  17. track: Object
  18. };
  19. /**
  20. * React component for displaying video. This component defers to lib-jitsi-meet
  21. * logic for rendering the video.
  22. *
  23. * @extends Component
  24. */
  25. class VideoInputPreview extends Component<Props> {
  26. /**
  27. * Implements React's {@link Component#render()}.
  28. *
  29. * @inheritdoc
  30. * @returns {ReactElement}
  31. */
  32. render() {
  33. const { error } = this.props;
  34. const errorClass = error ? VIDEO_ERROR_CLASS : '';
  35. const className = `video-input-preview ${errorClass}`;
  36. return (
  37. <div className = { className }>
  38. <Video
  39. className = 'video-input-preview-display flipVideoX'
  40. videoTrack = {{ jitsiTrack: this.props.track }} />
  41. <div className = 'video-input-preview-error'>
  42. { error || '' }
  43. </div>
  44. </div>
  45. );
  46. }
  47. }
  48. export default VideoInputPreview;