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

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