I'm not sure where to begin, but I can't stream every mp4 video i upload, primary ones with higher quality/resolution, the network tab shows 0 bytes coming in, and I just wanted to confirm whether it was the way I did things or not:
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
//console.log('got file', filename, mimetype, encoding);
var writeStream = gfs.createWriteStream({
_id: fileId,
filename: filename,
mode: 'w',
content_type: mimetype,
});
file.pipe(writeStream);
}).on('finish', function() {
// show a link to the uploaded file
req.user.videos.push(fileId);
req.user.save();
//console.log(req.user);
res.end();
/*var proc = new ffmpeg('/Documents/20000pitches/parkour.mp4')
.takeScreenshots({
count: 1,
timemarks: [ '600' ] // number of seconds
}, '/', function(err) {
console.log('screenshots were saved')
});
*/
});
req.pipe(busboy);
});
app.get('/file/:id', function(req, res) {
gfs.findOne({ _id: req.params.id }, function (err, file) {
if (err) return res.status(400).send(err);
if (!file) return res.status(404).send('');
res.set('Content-Type', file.contentType);
res.set('Content-Disposition', 'attachment; filename="' + file.filename + '"');
var readstream = gfs.createReadStream({
_id: file._id
});
readstream.on("error", function(err) {
console.log("Got error while processing stream " + err.message);
res.end();
});
readstream.pipe(res);
});
});
It does work sometimes, for example if I take a video from youtube, download the mp4 and upload it, it will play, however if I record a video from my android phone, upload it to dropbox, then from my comp to the web application it wont play. I went more in depth in stack overflow, but I don't know if this could be a gridfs issue or a player issue. I mostly used 3/4 players and all had the same result:
I'm not sure where to begin, but I can't stream every mp4 video i upload, primary ones with higher quality/resolution, the network tab shows 0 bytes coming in, and I just wanted to confirm whether it was the way I did things or not:
It does work sometimes, for example if I take a video from youtube, download the mp4 and upload it, it will play, however if I record a video from my android phone, upload it to dropbox, then from my comp to the web application it wont play. I went more in depth in stack overflow, but I don't know if this could be a gridfs issue or a player issue. I mostly used 3/4 players and all had the same result:
http://stackoverflow.com/questions/36760404/express-multer-uploading-moderate-large-files-not-playing-on-player
The version number is "gridfs-stream": "^1.1.1" atleast, thanks.