<Bundle fetchComponent={Video} loading={this.renderLoadingVideoPlayer} >
{Component => (<Component
preview={attachment.get('preview_url')}
+ frameRate={attachment.getIn(['meta', 'original', 'frame_rate'])}
blurhash={attachment.get('blurhash')}
src={attachment.get('url')}
alt={attachment.get('description')}
<div className='video-modal__container'>
<Video
preview={media.get('preview_url')}
+ frameRate={media.getIn(['meta', 'original', 'frame_rate'])}
blurhash={media.get('blurhash')}
src={media.get('url')}
currentTime={options.startTime}
static propTypes = {
preview: PropTypes.string,
+ frameRate: PropTypes.string,
src: PropTypes.string.isRequired,
alt: PropTypes.string,
width: PropTypes.number,
muted: PropTypes.bool,
};
+ static defaultProps = {
+ frameRate: 25,
+ };
+
state = {
currentTime: 0,
duration: 0,
}
handleKeyDown = e => {
- const frameTime = 1 / 25;
+ const frameTime = 1 / this.getFrameRate();
switch(e.key) {
case 'k':
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 () {
const { preview, src, inline, onOpenVideo, onCloseVideo, intl, alt, letterbox, fullwidth, detailed, sensitive, link, editable, blurhash } = this.props;
const { containerWidth, currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state;