diff options
Diffstat (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js')
| -rw-r--r-- | animism-align/frontend/app/views/viewer/viewer.actions.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index 5673fd8..c1b11be 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -8,6 +8,7 @@ import { FULLSCREEN_UTILITY_ANNOTATION_TYPES, CURTAIN_COLOR_LOOKUP, } from 'app/constants' +import { floatInRange } from 'app/utils' import { buildParagraphs } from 'app/utils/transcript.utils' import { annotationFadeTimings } from 'app/utils/annotation.utils' @@ -207,6 +208,29 @@ export const seekToMediaItem = (section, mediaItem) => dispatch => { actions.viewer.hideComponent('checklist') } +export const seekToTimestamp = play_ts => dispatch => { + actions.viewer.setSectionFromTimestamp(play_ts) + actions.audio.seek(play_ts) + actions.audio.play() +} + +export const setSectionFromTimestamp = play_ts => dispatch => { + const { sections, currentSection } = store.getState().viewer + const insideSection = sections.some((section, i) => { + if (floatInRange(section.start_ts, play_ts, section.end_ts)) { + if (currentSection !== section) { + const nextSection = sections[i+1] + actions.viewer.setCurrentSection(section, nextSection) + } + return true + } + return false + }) + if (!insideSection) { + actions.viewer.setCurrentSection(sections[sections.length-1], null) + } +} + export const openVitrineModal = (media, id) => dispatch => { console.log(media) const index = media.settings.image_order.indexOf(id) |
