video works although may have bugs
This commit is contained in:
@@ -8,15 +8,27 @@ import { secondsToTime } from '../lib/strformat.js'
|
||||
export default class InlineVideo extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.videoRef = React.createRef();
|
||||
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
}
|
||||
|
||||
handleClick(e) {
|
||||
if (this.props.onClick) {
|
||||
// the click target has to be the image element.
|
||||
this.props.onClick(e);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const duration = secondsToTime(this.props['data-duration'] / 1000);
|
||||
const className = 'inline-video' + (this.props.onClick ? ' clickable' : '');
|
||||
return (
|
||||
<div className="inline-video">
|
||||
<div className={className}>
|
||||
{React.createElement('img', this.props)}
|
||||
{this.props.onClick ?
|
||||
<div className="play-control" onClick={this.props.onClick}>
|
||||
<div className="play-control">
|
||||
<i className="material-icons white bigger">play_arrow</i>
|
||||
</div>
|
||||
: null}
|
||||
|
||||
Reference in New Issue
Block a user