make thumbnail for audio so browser stop complaining
This commit is contained in:
parent
679b53a993
commit
a87d194c2e
1 changed files with 5 additions and 2 deletions
|
@ -316,7 +316,10 @@ async function generateWaveform(f) {
|
||||||
.on('error', function(err, stdout, stderr) {
|
.on('error', function(err, stdout, stderr) {
|
||||||
return console.log('Cannot process video: ' + err.message);
|
return console.log('Cannot process video: ' + err.message);
|
||||||
})
|
})
|
||||||
.save(`./public/thumbnail/${f.replace(path.extname(f), '.mp4')}`)
|
.on('end', () => {
|
||||||
|
generateThumbnail(`../thumbnail/${f.replace(path.extname(f), '.mp4')}`);
|
||||||
|
})
|
||||||
|
.save(`./public/thumbnail/${f.replace(path.extname(f), '.mp4')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateThumbnail(f) {
|
async function generateThumbnail(f) {
|
||||||
|
@ -331,7 +334,7 @@ async function generateThumbnail(f) {
|
||||||
return console.log('Cannot process video: ' + err.message);
|
return console.log('Cannot process video: ' + err.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!fs.existsSync(`./public/thumbnail/tmp/${f}`))
|
if (!fs.existsSync(`./public/thumbnail/tmp/${f}`) && !f.startsWith('../thumbnail'))
|
||||||
fs.mkdirSync(`./public/thumbnail/tmp/${f}`)
|
fs.mkdirSync(`./public/thumbnail/tmp/${f}`)
|
||||||
|
|
||||||
ffmpeg(`./public/uploads/${f}`)
|
ffmpeg(`./public/uploads/${f}`)
|
||||||
|
|
Loading…
Reference in a new issue