From d46d47ee9c79dce950bd149c4c5097476e6ce060 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 29 Oct 2020 17:30:22 +0100 Subject: getting scrubber working with the new start ts --- .../components.fullscreen/fullscreen.video.js | 20 ++++++++++++++- .../player/components.media/video.scrubber.js | 29 ++++++++++++++++------ 2 files changed, 41 insertions(+), 8 deletions(-) (limited to 'animism-align/frontend/app/views/viewer') 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 (
@@ -93,11 +108,11 @@ class VideoScrubber extends Component {
{timestampText}
-- cgit v1.2.3-70-g09d2