In my meteor app, i use youtube-dl to download video from youtube and others websites; actually, i can get information about the video from server side using code below
var exec = Meteor.npmRequire('child_process').exec;
var Future = Meteor.npmRequire("fibers/future");
Meteor.methods({
'comman': function(url){
this.unblock();
var future = new Future();
exec("youtube-dl -F " + url, function(error, stdout, stderr) {
future.return({stdout: stdout, stderr: stderr});
});
return future.wait();
}
});
And the call on the client
Meteor.call('comman', url, function(error, result){
if (result.stdout) {
console.log('output:' + result.stdout);
} else {
console.log('error:'+ result.stderr);
}
});
The next step is that the user can seee thumbnail of the video, the list of formats available, be able to download and save the format he wants from the client side;
How can I perform that?? Any ideas?
Thank’s for your help