Skip to content

Commit 1b9c1de

Browse files
committed
adding preview thumbnails
1 parent 50a468e commit 1b9c1de

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

models/Upload.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ const uploadSchema = new mongoose.Schema({
179179
// when the backend finished processing the upload
180180
processingCompletedAt: Date,
181181

182-
// string, such as UnIqUe.webvtt used by default to indicate it's in the same directory with the upload
183-
webVTTPath: String,
184-
185182
// data returned from running ffprobe against the upload
186-
ffprobeData: mongoose.Schema.Types.Mixed
183+
ffprobeData: mongoose.Schema.Types.Mixed,
184+
185+
// the expected path is $uniqueTag_sprite.vtt in the same directory
186+
hasPreviewSpriteThumbnail: Boolean
187187

188188
}, {
189189
timestamps: true,

views/mediaPlayerPartials/plyrAndAutoplayFunctionalityJs.pug

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,19 @@ script.
111111
settings: ['speed', 'captions', 'quality', 'loop'],
112112
fullscreen: {iosNative: true},
113113
seekTime,
114-
previewThumbnails: {
114+
};
115+
116+
const hasPreviewThumbnail = #{upload.hasPreviewSpriteThumbnail}
117+
118+
if(hasPreviewThumbnail){
119+
const previewThumbnails = {
115120
enabled: true,
116121
src: [`/uploads/#{upload.uploader.channelUrl}/#{upload.uniqueTag}_sprite.vtt`],
117-
},
118-
};
122+
}
123+
124+
plyr_options.previewThumbnails = previewThumbnails;
125+
}
119126

120-
// TODO: add sprite
121-
// if (#{upload.hasPreviewSpriteThumbnail}) {
122-
//
123-
// let previewThumbnails = {
124-
// enabled: true,
125-
// src: ['/uploads/anthony/newVideoTrimmed.vtt'],
126-
// }
127-
//
128-
// plyr_options.previewThumbnails = previewThumbnails;
129-
// }
130127

131128
// Create the plyr instances - this defines players[0] as our primary player.
132129
var players = Plyr.setup("#media_player", plyr_options);

0 commit comments

Comments
 (0)