diff options
Diffstat (limited to 'animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js')
| -rw-r--r-- | animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js b/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js index 78c7807..b8d1a62 100644 --- a/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js +++ b/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js @@ -3,14 +3,22 @@ import { connect } from 'react-redux' import VimeoPlayer from 'app/utils/vendor/vimeo' import actions from 'app/actions' +import { timestampToSeconds } from 'app/utils' import { VideoScrubber } from '../components.media' class FullscreenVideo extends Component { state = { + // duration of the video, in seconds duration: 0.0, + // percentage offset from vimeo. not used percent: 0.0, + // current timestamp from vimeo, in seconds seconds: 0.0, + // video start offset, in seconds + video_start_ts: 0.0, + // seek position, used to tell the player to seek seek: 0.0, + // whether or not the scrubber is scrubbing scrubbing: false, } constructor(props) { @@ -20,6 +28,14 @@ class FullscreenVideo extends Component { this.handleTimeUpdate = this.handleTimeUpdate.bind(this) this.handleEnd = this.handleEnd.bind(this) } + componentDidMount() { + const { video_start_ts } = this.props.element.settings + const seconds = timestampToSeconds(video_start_ts) || 0.0 + this.setState({ + video_start_ts: seconds, + seek: seconds, + }) + } componentDidUpdate(prevProps) { if (Math.abs(this.props.play_ts - prevProps.play_ts) > 1.0) { // handle seek @@ -44,7 +60,7 @@ class FullscreenVideo extends Component { render() { const { element, media, transitionDuration, playing } = this.props - const { duration, percent, seconds } = this.state + const { duration, seconds } = this.state const { color } = element const item = media.lookup[element.settings.media_id] const style = { @@ -52,6 +68,7 @@ class FullscreenVideo extends Component { color: color.textColor, transitionDuration, } + // return ( <div className='fullscreen-element video' @@ -76,6 +93,7 @@ class FullscreenVideo extends Component { </div> <VideoScrubber start_ts={element.start_ts} + video_start_ts={this.state.video_start_ts} playing={playing} duration={element.duration} timing={this.state} |
