|
|
@ -99,6 +99,7 @@ class Video extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
static propTypes = {
|
|
|
|
preview: PropTypes.string,
|
|
|
|
preview: PropTypes.string,
|
|
|
|
|
|
|
|
frameRate: PropTypes.string,
|
|
|
|
src: PropTypes.string.isRequired,
|
|
|
|
src: PropTypes.string.isRequired,
|
|
|
|
alt: PropTypes.string,
|
|
|
|
alt: PropTypes.string,
|
|
|
|
width: PropTypes.number,
|
|
|
|
width: PropTypes.number,
|
|
|
@ -123,6 +124,10 @@ class Video extends React.PureComponent {
|
|
|
|
muted: PropTypes.bool,
|
|
|
|
muted: PropTypes.bool,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
|
|
|
|
frameRate: 25,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
state = {
|
|
|
|
state = {
|
|
|
|
currentTime: 0,
|
|
|
|
currentTime: 0,
|
|
|
|
duration: 0,
|
|
|
|
duration: 0,
|
|
|
@ -288,7 +293,7 @@ class Video extends React.PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleKeyDown = e => {
|
|
|
|
handleKeyDown = e => {
|
|
|
|
const frameTime = 1 / 25;
|
|
|
|
const frameTime = 1 / this.getFrameRate();
|
|
|
|
|
|
|
|
|
|
|
|
switch(e.key) {
|
|
|
|
switch(e.key) {
|
|
|
|
case 'k':
|
|
|
|
case 'k':
|
|
|
@ -517,6 +522,17 @@ class Video extends React.PureComponent {
|
|
|
|
this.props.onCloseVideo();
|
|
|
|
this.props.onCloseVideo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getFrameRate () {
|
|
|
|
|
|
|
|
if (this.props.frameRate && isNaN(this.props.frameRate)) {
|
|
|
|
|
|
|
|
// The frame rate is returned as a fraction string so we
|
|
|
|
|
|
|
|
// need to convert it to a number
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.props.frameRate.split('/').reduce((p, c) => p / c);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.props.frameRate;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
render () {
|
|
|
|
const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, link, editable, blurhash } = this.props;
|
|
|
|
const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, detailed, sensitive, link, editable, blurhash } = this.props;
|
|
|
|
const { containerWidth, currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state;
|
|
|
|
const { containerWidth, currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state;
|
|
|
|