summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/viewer.actions.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-08-26 17:55:10 +0200
committerJules Laplace <julescarbon@gmail.com>2020-08-26 17:55:10 +0200
commitda76513e9d5c2a0a1660ac321f126d7c79bf6392 (patch)
treeb92b47fb529ffef6f5a385a2fdb30a0f7cfb158c /animism-align/frontend/app/views/viewer/viewer.actions.js
parent9f57a7f41ac4a8d2526f2b169193010eb76023a2 (diff)
adjusting timing, pause at end of section
Diffstat (limited to 'animism-align/frontend/app/views/viewer/viewer.actions.js')
-rw-r--r--animism-align/frontend/app/views/viewer/viewer.actions.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js
index 5d6775f..097f01b 100644
--- a/animism-align/frontend/app/views/viewer/viewer.actions.js
+++ b/animism-align/frontend/app/views/viewer/viewer.actions.js
@@ -156,10 +156,6 @@ const makeFullscreenEvent = (index, annotation) => {
return event
}
-export const setCurrentSection = (currentSection, nextSection) => dispatch => {
- dispatch({ type: types.viewer.set_current_section, currentSection, nextSection })
-}
-
export const setNavStyle = color => dispatch => {
dispatch({ type: types.viewer.set_nav_style, color })
}
@@ -176,13 +172,32 @@ export const toggleComponent = key => dispatch => {
dispatch({ type: types.viewer.toggle_component, key, value: !store.getState().viewer[key] })
}
+const getNextSection = section => {
+ const { sections } = store.getState().viewer
+ if (section.index === sections.length - 1) {
+ return null
+ }
+ return sections[section.index + 1]
+}
+
+export const reachedEndOfSection = () => dispatch => {
+ actions.audio.pause()
+ dispatch({ type: types.viewer.reached_end_of_section })
+}
+
+export const setCurrentSection = (currentSection, nextSection) => dispatch => {
+ dispatch({ type: types.viewer.set_current_section, currentSection, nextSection })
+}
+
export const seekToSection = section => dispatch => {
+ actions.viewer.setCurrentSection(section, getNextSection(section))
actions.audio.seek(section.start_ts)
actions.audio.play()
actions.viewer.hideComponent('nav')
}
-export const seekToMediaItem = mediaItem => dispatch => {
+export const seekToMediaItem = (section, mediaItem) => dispatch => {
+ actions.viewer.setCurrentSection(section, getNextSection(section))
actions.audio.seek(mediaItem.start_ts)
actions.audio.play()
actions.viewer.hideComponent('nav')