summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/viewer.actions.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-08-28 17:43:04 +0200
committerJules Laplace <julescarbon@gmail.com>2020-08-28 17:43:04 +0200
commit1b48663dd1a2dffc0f06e6a072a3a9f0925081a0 (patch)
tree2d144b2ca4589aca75bc03dcd404a129e0512345 /animism-align/frontend/app/views/viewer/viewer.actions.js
parent00f4f6685881d72fd98020aac69d34e87345b3d8 (diff)
properly seek to media in transcript
Diffstat (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js')
-rw-r--r--animism-align/frontend/app/views/viewer/viewer.actions.js24
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)