From 6916799d455c74ca18ba2de086983541fa6d3fc6 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 5 Nov 2020 17:08:56 +0100 Subject: introducing stuff for fading in audio --- .../viewer/player/components.fullscreen/fullscreen.video.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'animism-align/frontend/app/views/viewer/player/components.fullscreen') 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 e226bab..adbc22a 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 @@ -40,13 +40,21 @@ class FullscreenVideo extends Component { }) } componentDidUpdate(prevProps) { - if (Math.abs(this.props.play_ts - prevProps.play_ts) > 1.0) { + // if the play_ts jumped more than a second, seek + const { play_ts, element } = this.props + if (Math.abs(play_ts - prevProps.play_ts) > 1.0) { // handle seek - const { play_ts, element } = this.props const { duration, video_start_ts } = this.state const seek = ((play_ts - element.start_ts) % duration) + video_start_ts this.setState({ seek }) } + // if we started leaving the element... + if (this.props.isLeaving && this.props.isLeaving !== prevProps.isLeaving && element.settings.unmuted) { + this.fadeOutAudio() + } + } + fadeOutAudio() { + console.log("fade out audio", this.props.fadeOutDuration) } handlePlay() { this.setState({ ready: true }) -- cgit v1.2.3-70-g09d2