2017-05-02 17:04:16 -07:00
|
|
|
import React from 'react';
|
2017-04-13 06:04:18 -07:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2017-04-21 11:05:35 -07:00
|
|
|
import PropTypes from 'prop-types';
|
2017-12-03 23:26:40 -08:00
|
|
|
import Video from 'flavours/glitch/features/video';
|
2017-05-02 17:04:16 -07:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2017-04-13 06:04:18 -07:00
|
|
|
|
2017-06-23 10:36:54 -07:00
|
|
|
export default class VideoModal extends ImmutablePureComponent {
|
2017-04-13 06:04:18 -07:00
|
|
|
|
2019-05-03 07:16:30 -07:00
|
|
|
static contextTypes = {
|
|
|
|
router: PropTypes.object,
|
|
|
|
};
|
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
static propTypes = {
|
|
|
|
media: ImmutablePropTypes.map.isRequired,
|
2020-11-26 18:24:11 -08:00
|
|
|
statusId: PropTypes.string,
|
2020-04-25 03:16:05 -07:00
|
|
|
options: PropTypes.shape({
|
|
|
|
startTime: PropTypes.number,
|
|
|
|
autoPlay: PropTypes.bool,
|
|
|
|
defaultVolume: PropTypes.number,
|
|
|
|
}),
|
2017-05-12 05:44:10 -07:00
|
|
|
onClose: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
2017-04-13 06:04:18 -07:00
|
|
|
render () {
|
2020-11-26 18:24:11 -08:00
|
|
|
const { media, onClose } = this.props;
|
2020-04-25 03:16:05 -07:00
|
|
|
const options = this.props.options || {};
|
2019-05-03 07:16:30 -07:00
|
|
|
|
2017-04-13 06:04:18 -07:00
|
|
|
return (
|
2018-04-08 14:15:25 -07:00
|
|
|
<div className='modal-root__modal video-modal'>
|
2019-10-02 18:34:58 -07:00
|
|
|
<div className='video-modal__container'>
|
2017-09-13 18:39:10 -07:00
|
|
|
<Video
|
|
|
|
preview={media.get('preview_url')}
|
2020-11-21 14:19:04 -08:00
|
|
|
frameRate={media.getIn(['meta', 'original', 'frame_rate'])}
|
2019-04-26 18:24:09 -07:00
|
|
|
blurhash={media.get('blurhash')}
|
2017-09-13 18:39:10 -07:00
|
|
|
src={media.get('url')}
|
2020-09-28 04:29:43 -07:00
|
|
|
currentTime={options.startTime}
|
2020-04-25 03:16:05 -07:00
|
|
|
autoPlay={options.autoPlay}
|
2020-09-28 04:29:43 -07:00
|
|
|
volume={options.defaultVolume}
|
2017-09-13 18:39:10 -07:00
|
|
|
onCloseVideo={onClose}
|
2018-01-13 10:41:20 -08:00
|
|
|
detailed
|
2018-09-11 06:45:51 -07:00
|
|
|
alt={media.get('description')}
|
2017-09-13 18:39:10 -07:00
|
|
|
/>
|
2017-04-13 06:04:18 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-04-21 11:05:35 -07:00
|
|
|
}
|