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.

VideoTrack.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import AbstractVideoTrack from '../AbstractVideoTrack';
  4. import Video from './Video';
  5. /**
  6. * Component that renders a video element for a passed in video track and
  7. * notifies the store when the video has started playing.
  8. *
  9. * @extends AbstractVideoTrack
  10. */
  11. class VideoTrack extends AbstractVideoTrack {
  12. /**
  13. * Default values for {@code VideoTrack} component's properties.
  14. *
  15. * @static
  16. */
  17. static defaultProps = {
  18. ...AbstractVideoTrack.defaultProps,
  19. className: '',
  20. id: ''
  21. };
  22. /**
  23. * {@code VideoTrack} component's property types.
  24. *
  25. * @static
  26. */
  27. static propTypes = {
  28. ...AbstractVideoTrack.propTypes,
  29. /**
  30. * CSS classes to add to the video element.
  31. */
  32. className: React.PropTypes.string,
  33. /**
  34. * The value of the id attribute of the video. Used by the torture tests
  35. * to locate video elements.
  36. */
  37. id: React.PropTypes.string
  38. };
  39. /**
  40. * Renders the video element.
  41. *
  42. * @override
  43. * @returns {ReactElement}
  44. */
  45. render() {
  46. return (
  47. <Video
  48. autoPlay = { true }
  49. className = { this.props.className }
  50. id = { this.props.id }
  51. onVideoPlaying = { this._onVideoPlaying }
  52. videoTrack = { this.props.videoTrack } />
  53. );
  54. }
  55. }
  56. export default connect()(VideoTrack);