2018-10-30 05:02:23 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2017-07-14 19:22:27 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import AbstractVideoTrack from '../AbstractVideoTrack';
|
2018-10-30 05:02:23 +00:00
|
|
|
import type { Props as AbstractVideoTrackProps } from '../AbstractVideoTrack';
|
2017-07-14 19:22:27 +00:00
|
|
|
|
2017-08-30 23:58:19 +00:00
|
|
|
import Video from './Video';
|
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link VideoTrack}.
|
|
|
|
*/
|
2019-03-19 15:42:25 +00:00
|
|
|
type Props = AbstractVideoTrackProps & {
|
2018-10-30 05:02:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CSS classes to add to the video element.
|
|
|
|
*/
|
|
|
|
className: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The value of the id attribute of the video. Used by the torture tests
|
|
|
|
* to locate video elements.
|
|
|
|
*/
|
|
|
|
id: string
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
class VideoTrack extends AbstractVideoTrack<Props> {
|
2017-07-14 19:22:27 +00:00
|
|
|
/**
|
|
|
|
* Default values for {@code VideoTrack} component's properties.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static defaultProps = {
|
|
|
|
className: '',
|
|
|
|
|
|
|
|
id: ''
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
);
|
|
|
|
}
|
2018-10-30 05:02:23 +00:00
|
|
|
|
|
|
|
_onVideoPlaying: () => void;
|
2017-07-14 19:22:27 +00:00
|
|
|
}
|
|
|
|
|
2019-03-19 15:42:25 +00:00
|
|
|
// $FlowExpectedError
|
2017-07-14 19:22:27 +00:00
|
|
|
export default connect()(VideoTrack);
|