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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import Video from '../../base/media/components/Video';
  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. playsinline = { true }
  41. videoTrack = {{ jitsiTrack: this.props.track }} />
  42. <div className = 'video-input-preview-error'>
  43. { error || '' }
  44. </div>
  45. </div>
  46. );
  47. }
  48. }
  49. export default VideoInputPreview;