Skip to content

Instantly share code, notes, and snippets.

@KarneAsada
Created October 30, 2018 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KarneAsada/37f252e2e658391286e780c5d5b6a60a to your computer and use it in GitHub Desktop.
Save KarneAsada/37f252e2e658391286e780c5d5b6a60a to your computer and use it in GitHub Desktop.
diff --git a/server/routes/hls-player.js b/server/routes/hls-player.js
index f6b6b61..bd0e9c1 100644
--- a/server/routes/hls-player.js
+++ b/server/routes/hls-player.js
@@ -50,13 +50,6 @@ function processStory(tStoryObj) {
// Set Chapter Id
chapter.id = chapter._id
const { currentVersion } = chapter
- const chapterImage = currentVersion.renderedImage || currentVersion.baseImage
- if (chapterImage && chapterImage.path) {
- chapter.start = totalDuration
- chapter.duration = 6000
- chapter.image = chapterImage.path.replace(gcsDomain, imageCDN)
- return chapter
- }
// Add start and duration times to each chapter
const chapterVideo = currentVersion.intermediateVideo
@@ -67,6 +60,16 @@ function processStory(tStoryObj) {
totalDuration += chapter.duration
return chapter
}
+
+ // Set chapter image if no video exists
+ const chapterImage = currentVersion.renderedImage || currentVersion.baseImage
+ if (chapterImage && chapterImage.path) {
+ chapter.start = totalDuration
+ chapter.duration = 6000
+ chapter.image = chapterImage.path.replace(gcsDomain, imageCDN)
+ return chapter
+ }
+
console.error(`No video object for chapter ${chapter._id}`)
return undefined
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment