summaryrefslogtreecommitdiff
path: root/animism-align/frontend
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-10-14 15:26:55 +0200
committerJules Laplace <julescarbon@gmail.com>2020-10-14 15:26:55 +0200
commit38fd1460b6de1a72b1345c5f23ea688c54f14689 (patch)
treee0b74a696d19616ef31d0fc05e1f4a51056ce6ed /animism-align/frontend
parent7ed7efb524e7984e8e1ca0da77a882412a748174 (diff)
option to loop video
Diffstat (limited to 'animism-align/frontend')
-rw-r--r--animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.video.js6
-rw-r--r--animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js3
-rw-r--r--animism-align/frontend/app/views/viewer/viewer.actions.js10
3 files changed, 15 insertions, 4 deletions
diff --git a/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.video.js b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.video.js
index b89a412..ce07d09 100644
--- a/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.video.js
+++ b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.video.js
@@ -43,6 +43,12 @@ export const AnnotationFormVideo = ({ annotation, media, handleSettingsSelect, h
onChange={handleSettingsSelect}
/>
<Checkbox
+ label="Loop"
+ name="loop"
+ checked={annotation.settings.loop}
+ onChange={handleSettingsSelect}
+ />
+ <Checkbox
label="Show poster image"
name="poster"
checked={annotation.settings.poster}
diff --git a/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js b/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js
index 929daef..2d249a4 100644
--- a/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js
+++ b/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js
@@ -23,7 +23,7 @@ class FullscreenVideo extends Component {
componentDidUpdate(prevProps) {
if (Math.abs(this.props.play_ts - prevProps.play_ts) > 2.0) {
// handle seek
- const seek = this.props.play_ts - this.props.element.start_ts
+ const seek = (this.props.play_ts - this.props.element.start_ts) % this.state.duration
this.setState({ seek })
}
}
@@ -63,6 +63,7 @@ class FullscreenVideo extends Component {
paused={!playing}
autoplay={true}
muted={true}
+ loop={!!element.settings.loop}
seek={this.state.seek}
responsive={true}
controls={false}
diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js
index d63ced5..3800623 100644
--- a/animism-align/frontend/app/views/viewer/viewer.actions.js
+++ b/animism-align/frontend/app/views/viewer/viewer.actions.js
@@ -137,15 +137,15 @@ export const loadSections = () => dispatch => {
if (currentSection) {
currentSection.mediaLabels = Object.keys(currentMediaLabels).sort().join(', ')
currentSection.paragraphs = buildParagraphs(sectionTextAnnotationOrder, currentSection.index)
- currentSection.duration = timeline.duration
+ currentSection.end_ts = timeline.duration
}
let time_to_first_fullscreen_element, initial_curtain_event
// last fixes on the sections
- for (let i = 0; i < sections.length - 1; i++) {
+ for (let i = 0; i < sections.length; i++) {
currentSection = sections[i]
// set the end_ts for each section (i.e. just before the next section starts)
- if (currentSection.end_ts === 0) {
+ if (currentSection.end_ts === 0 && i < sections.length - 1) {
currentSection.end_ts = sections[i+1].start_ts - 1
}
// if the first fullscreen event is close to the beginning of the section, move it there
@@ -206,6 +206,8 @@ const makeFullscreenEvent = (index, annotation) => {
}
if (annotation.settings.color) {
event.color = CURTAIN_COLOR_LOOKUP[annotation.settings.color] || CURTAIN_COLOR_LOOKUP.white
+ } else {
+ event.color = CURTAIN_COLOR_LOOKUP.white
}
return event
}
@@ -351,6 +353,8 @@ export const vitrineGo = direction => dispatch => {
}
}
+/* growl */
+
export const openGrowl = message => dispatch => {
dispatch({ type: types.viewer.open_growl, message })
}