mercredi 18 février 2015

Downloaded Ziggeo videos corrupt?

I'm on Windows 8.1 running node 10.22, express 4.11.2


I'm trying download a file from the Ziggeo API, but the resulting file comes out corrupt.



var express = require('express');
var app = express();

app.get('/download/:id',function(req,res){
downloadVideo(req.params.id,res);
});

function downloadVideo(id,res){
sdk.Videos.download_video(id,function(back){
fs.writeFile('downloadedVideo.mp4',back,function(err){
if(err){
console.log(err);
res.sendStatus(400);
}else{
res.sendStatus(200);
res.end();
}
});
});
}


The resulting file is corrupt and cannot be played.


When I download the same video using the Ziggeo dashboard, the filesize is bigger and I can play it back fine.


If I open the two files as text files and diff them, there are a few lines of similarities, but the files are largely different.


I've tried all three encoding types that writeFile takes as a parameter, but none of those help.


I also tried the Streams.download_video method, and that gives the same results.


Aucun commentaire:

Enregistrer un commentaire