they're actually mp4s
This commit is contained in:
parent
7bacd174f6
commit
11c7a7b47f
|
@ -80,8 +80,8 @@ exports.save = async (ws, req) => {
|
|||
const file = fs.readdirSync("videos").find(f => f.includes(id))
|
||||
if (file) {
|
||||
ws.send('DATA - Uploading file...')
|
||||
const videoUrl = await upload.uploadVideo(`./videos/${id}.webm`)
|
||||
fs.unlinkSync(`./videos/${id}.webm`)
|
||||
const videoUrl = await upload.uploadVideo(`./videos/${id}.mp4`)
|
||||
fs.unlinkSync(`./videos/${id}.mp4`)
|
||||
|
||||
await websocket.createDatabaseVideo(id, videoUrl)
|
||||
|
||||
|
@ -178,9 +178,9 @@ exports.playlist = async (ws, req) => {
|
|||
ws.send(`DATA - Downloaded ${video.title}`)
|
||||
ws.send(`DATA - Uploading ${video.title}`)
|
||||
|
||||
const videoUrl = await upload.uploadVideo(`./videos/${id}.webm`)
|
||||
const videoUrl = await upload.uploadVideo(`./videos/${id}.mp4`)
|
||||
ws.send(`DATA - Uploaded ${video.title}`)
|
||||
fs.unlinkSync(`./videos/${id}.webm`)
|
||||
fs.unlinkSync(`./videos/${id}.mp4`)
|
||||
|
||||
await websocket.createDatabaseVideo(id, videoUrl, playlistId)
|
||||
ws.send(`DATA - Created video page for ${video.title}`)
|
||||
|
@ -276,9 +276,9 @@ exports.channel = async (ws, req) => {
|
|||
ws.send(`DATA - Downloaded ${video.title}`)
|
||||
ws.send(`DATA - Uploading ${video.title}`)
|
||||
|
||||
const videoUrl = await upload.uploadVideo(`./videos/${id}.webm`)
|
||||
const videoUrl = await upload.uploadVideo(`./videos/${id}.mp4`)
|
||||
ws.send(`DATA - Uploaded ${video.title}`)
|
||||
fs.unlinkSync(`./videos/${id}.webm`)
|
||||
fs.unlinkSync(`./videos/${id}.mp4`)
|
||||
|
||||
await websocket.createDatabaseVideo(id, videoUrl)
|
||||
ws.send(`DATA - Created video page for ${video.title}`)
|
||||
|
|
|
@ -18,9 +18,9 @@ redis.on('ready', async function () {
|
|||
|
||||
setInterval(async () => {
|
||||
const files = fs.readdirSync('videos')
|
||||
const webmFiles = files.filter((file) => file.endsWith('.webm'))
|
||||
const webmFiles = files.filter((file) => file.endsWith('.mp4'))
|
||||
webmFiles.forEach(async (f) => {
|
||||
const videoId = f.replace('.webm', '')
|
||||
const videoId = f.replace('.mp4', '')
|
||||
const isActive = await redis.get(videoId)
|
||||
if (!isActive) {
|
||||
fs.unlinkSync(`./videos/${f}`)
|
||||
|
|
|
@ -18,7 +18,7 @@ async function uploadVideo(video) {
|
|||
Bucket: key.bucket,
|
||||
Key: video.split('/')[2],
|
||||
Body: videoFile,
|
||||
ContentType: 'video/webm',
|
||||
ContentType: 'video/mp4',
|
||||
}).promise()
|
||||
|
||||
return uploaded.Location
|
||||
|
|
|
@ -28,7 +28,7 @@ async function downloadVideo(url, ws, id) {
|
|||
let prevBytes = 0
|
||||
let speed = 0
|
||||
const alreadyPrecentages = []
|
||||
const download = wget.download(downloadJson.url, `./videos/${id}.webm`)
|
||||
const download = wget.download(downloadJson.url, `./videos/${id}.mp4`)
|
||||
|
||||
download.on('start', fileSize => {
|
||||
size = fileSize
|
||||
|
|
Loading…
Reference in New Issue