diff options
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.js | 28 |
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) |
