diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-11-09 18:00:50 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-11-09 18:00:50 +0100 |
| commit | 4439ed0edb8eba1fb728c5c264cdb62d468901f8 (patch) | |
| tree | 9960aea12e6554c701d4a7d046454b483ee28217 /animism-align/frontend | |
| parent | 634abd7cec252e61dd171ffbbaa83dec87062bd1 (diff) | |
compare ends of timeline and use max point
Diffstat (limited to 'animism-align/frontend')
| -rw-r--r-- | animism-align/frontend/app/views/viewer/transcript/components/elementTypes.video.js | 5 | ||||
| -rw-r--r-- | animism-align/frontend/app/views/viewer/viewer.actions.js | 18 |
2 files changed, 13 insertions, 10 deletions
diff --git a/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.video.js b/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.video.js index 8e65843..6ad46b2 100644 --- a/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.video.js +++ b/animism-align/frontend/app/views/viewer/transcript/components/elementTypes.video.js @@ -60,7 +60,7 @@ class TranscriptVideoSubtitles extends Component { const { start_ts } = annotation const video_start_ts = timestampToSeconds(annotation.settings.video_start_ts) || 0.0 const subtitles = parseSubtitles(mediaItem, start_ts - video_start_ts) - console.log('subtitles', start_ts, video_start_ts, subtitles) + // console.log('subtitles', start_ts, video_start_ts, subtitles) if (subtitles) { this.setState({ subtitles, current: null }) } @@ -84,9 +84,10 @@ class TranscriptVideoSubtitles extends Component { {subtitles.map(subtitle => { return ( <span + key={subtitle.id} onClick={e => { e && e.stopPropagation() - console.log(subtitle, e) + // console.log(subtitle, e) actions.viewer.seekToTimestamp(subtitle.start_ts) }} className={subtitle === current ? 'current' : ""} diff --git a/animism-align/frontend/app/views/viewer/viewer.actions.js b/animism-align/frontend/app/views/viewer/viewer.actions.js index 86c8d2d..4389f51 100644 --- a/animism-align/frontend/app/views/viewer/viewer.actions.js +++ b/animism-align/frontend/app/views/viewer/viewer.actions.js @@ -60,7 +60,13 @@ export const loadSections = () => dispatch => { let { paragraphs, footnotes } = buildParagraphs(sectionTextAnnotationOrder, currentSection.index, footnoteList.length) currentSection.paragraphs = paragraphs footnoteList = footnoteList.concat(footnotes) - currentSection.end_ts = currentSection.paragraphs[currentSection.paragraphs.length - 1].end_ts + // get the last end_ts in the episode + currentSection.end_ts = ( + currentSection.fullscreenTimeline.reduce( + (a,b) => Math.max(a, b.end_ts), + currentSection.paragraphs[currentSection.paragraphs.length - 1].end_ts, + ) + ) } // create a new section and reset state variables currentSection = newSection(annotation, sections.length, mediaIndex) @@ -151,8 +157,7 @@ export const loadSections = () => dispatch => { let time_to_first_fullscreen_element, initial_curtain_event // last fixes on the sections - for (let i = 0; i < sections.length; i++) { - currentSection = sections[i] + sections.forEach((currentSection, i) => { // set the end_ts for each section (i.e. just before the next section starts) if (currentSection.end_ts === 0 && i < sections.length - 1) { currentSection.end_ts = sections[i+1].start_ts - 1 @@ -184,11 +189,8 @@ export const loadSections = () => dispatch => { currentSection.fullscreenTimeline.unshift(initial_curtain_event) } currentSection.duration = currentSection.end_ts - currentSection.start_ts - } - - sections.forEach((section) => { - section.inlineParagraphCount = section.paragraphs.filter(p => !p.hidden).length - // console.log(i, section.inlineParagraphCount) + currentSection.inlineParagraphCount = currentSection.paragraphs.filter(p => !p.hidden).length + // console.log(i, currentSection.inlineParagraphCount) }) // console.log(sections) // console.log(footnoteList) |
