From 046aeb54b96a2563395875657fddd062a5c3b4f7 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 22 Sep 2020 15:53:33 +0200 Subject: start on scroll --- .../frontend/app/views/viewer/viewer.actions.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js') diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index bdf5640..7566968 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -10,7 +10,7 @@ import { CURTAIN_COLOR_LOOKUP, GROWL, } from 'app/constants' -import { floatInRange } from 'app/utils' +import { floatInRange, timestampToSeconds } from 'app/utils' import { buildParagraphs } from 'app/utils/transcript.utils' import { annotationFadeTimings } from 'app/utils/annotation.utils' import { getNextSection } from 'app/utils/viewer.utils' @@ -111,6 +111,13 @@ export const loadSections = () => dispatch => { // build timeline of special inline items if (INLINE_UTILITY_ANNOTATION_TYPES.has(annotation.type)) { sectionTextAnnotationOrder.push(annotation.id) + if (annotation.type === 'intro') { + if (annotation.settings.intro_start_ts) { + currentSection.intro_start_ts = timestampToSeconds(annotation.settings.intro_start_ts) + } else { + currentSection.intro_start_ts = 0 + } + } } // build timeline of fullscreen events @@ -226,6 +233,15 @@ export const reachedEndOfSection = currentSection => dispatch => { } } +export const playFromClick = () => dispatch => { + const state = store.getState() + if (state.audio.play_ts === 0 && state.viewer.currentSection.intro_start_ts) { + actions.viewer.seekToTimestamp(state.viewer.currentSection.intro_start_ts) + } else { + actions.audio.play() + } +} + export const setCurrentSection = (currentSection, nextSection) => dispatch => { dispatch({ type: types.viewer.set_current_section, currentSection, nextSection }) } -- cgit v1.2.3-70-g09d2