summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/player/player.container.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/player/player.container.js
parent9f57a7f41ac4a8d2526f2b169193010eb76023a2 (diff)
adjusting timing, pause at end of section
Diffstat (limited to 'animism-align/frontend/app/views/viewer/player/player.container.js')
-rw-r--r--animism-align/frontend/app/views/viewer/player/player.container.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/animism-align/frontend/app/views/viewer/player/player.container.js b/animism-align/frontend/app/views/viewer/player/player.container.js
index 8a23720..a2f999d 100644
--- a/animism-align/frontend/app/views/viewer/player/player.container.js
+++ b/animism-align/frontend/app/views/viewer/player/player.container.js
@@ -20,25 +20,28 @@ class PlayerContainer extends Component {
}
setCurrentSection() {
- const { audio, sections, currentSection } = this.props
+ const { audio, sections, currentSection, autoAdvance } = this.props
const { play_ts } = audio
if (floatInRange(currentSection.start_ts, play_ts, currentSection.end_ts)) {
return
}
- 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)
+ if (autoAdvance) {
+ 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 true
+ return false
+ })
+ if (!insideSection) {
+ actions.viewer.setCurrentSection(sections[sections.length-1], null)
}
- return false
- })
-
- if (!insideSection) {
- actions.viewer.setCurrentSection(sections[sections.length-1], null)
+ } else {
+ actions.viewer.reachedEndOfSection()
}
}
@@ -60,6 +63,7 @@ const mapStateToProps = state => ({
audio: state.audio,
sections: state.viewer.sections,
currentSection: state.viewer.currentSection,
+ autoAdvance: state.viewer.autoAdvance,
})
export default connect(mapStateToProps)(PlayerContainer)