2017-09-27 21:23:31 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2017-07-14 19:22:27 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import AbstractVideoTrack from '../AbstractVideoTrack';
|
|
|
|
|
2017-08-30 23:58:19 +00:00
|
|
|
import Video from './Video';
|
|
|
|
|
2017-07-14 19:22:27 +00:00
|
|
|
/**
|
2017-08-31 17:20:44 +00:00
|
|
|
* Component that renders a video element for a passed in video track and
|
|
|
|
* notifies the store when the video has started playing.
|
2017-07-14 19:22:27 +00:00
|
|
|
*
|
|
|
|
* @extends AbstractVideoTrack
|
|
|
|
*/
|
|
|
|
class VideoTrack extends AbstractVideoTrack {
|
|
|
|
/**
|
|
|
|
* Default values for {@code VideoTrack} component's properties.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static defaultProps = {
|
|
|
|
...AbstractVideoTrack.defaultProps,
|
|
|
|
|
|
|
|
className: '',
|
|
|
|
|
|
|
|
id: ''
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@code VideoTrack} component's property types.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static propTypes = {
|
|
|
|
...AbstractVideoTrack.propTypes,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CSS classes to add to the video element.
|
|
|
|
*/
|
2017-09-27 21:23:31 +00:00
|
|
|
className: PropTypes.string,
|
2017-07-14 19:22:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The value of the id attribute of the video. Used by the torture tests
|
|
|
|
* to locate video elements.
|
|
|
|
*/
|
2017-09-27 21:23:31 +00:00
|
|
|
id: PropTypes.string
|
2017-07-14 19:22:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the video element.
|
|
|
|
*
|
|
|
|
* @override
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
2017-08-30 23:58:19 +00:00
|
|
|
<Video
|
|
|
|
autoPlay = { true }
|
|
|
|
className = { this.props.className }
|
|
|
|
id = { this.props.id }
|
|
|
|
onVideoPlaying = { this._onVideoPlaying }
|
|
|
|
videoTrack = { this.props.videoTrack } />
|
2017-07-14 19:22:27 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect()(VideoTrack);
|