Created
October 30, 2018 00:45
-
-
Save KarneAsada/b597e6db64e505e5a01f4912f5e8e4b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/server/controllers/hls.js b/server/controllers/hls.js | |
index 12c16cd..5b7589e 100644 | |
--- a/server/controllers/hls.js | |
+++ b/server/controllers/hls.js | |
@@ -110,16 +110,17 @@ controller.mediaPlaylist = async (req, res) => { | |
return | |
} | |
- // Skip Image Chapters | |
- const imageObj = currentVersion.renderedImage || currentVersion.baseImage | |
- if (imageObj && imageObj.path) { | |
- return | |
- } | |
- | |
// Skipping Video Chapters with missing segment data | |
const videoObj = currentVersion.intermediateVideo | |
|| currentVersion.renderedVideo || currentVersion.baseVideo | |
if (!(videoObj && videoObj.segmentBaseUrl)) { | |
+ // Return without error log if this is an image chapter | |
+ // @todo remove once image chapters are gone | |
+ const imageObj = currentVersion.renderedImage || currentVersion.baseImage | |
+ if (imageObj && imageObj.path) { | |
+ return | |
+ } | |
+ | |
console.error(`Chapter ${oneChapter._id} is missing required segment data`) | |
return | |
} | |
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