0

I'm using nodejs with express and this FTP node package

https://www.npmjs.com/package/ftp

here is what I do:

  var Client = require('ftp');
  var fs = require('fs');

  var c = new Client();
  c.on('ready', function() {
    c.get('foo.txt', function(err, stream) {
      if (err) throw err;
      stream.once('close', function() { c.end(); });
      stream.pipe(res);
    });
  });
  c.connect();

and in front I simply use a video player that get it's stream from that server

The issue I'm having is that the .get method does not provide a range parameter so I cannot get a specific part of a video (get a stream that start at 5mins of the video). I'm only capable to get a stream from it start's.

How could I manage to open a stream of a video on a FTP server with a giving range so I can later stream a specific part of that video using the range header coming from the client ?

Thanks a lot

angauber
  • 41
  • 4

1 Answers1

0

Have you found this example? Streaming a video file to an html5 video player with Node.js so that the video controls continue to work? You didn't provide any details on how are you loading the video on the frontend, add some snippets of how did you wrote that both on front and backend. IF you just need a way to pass range parametar through get request, you can use query, but you would have to manually implement that and I dont believe you would want to do that (/video.mpg?range=99)

  • Thanks for your answer, I updated my post with some exemples, the issue I'm having get is server-side related – angauber Jun 04 '19 at 12:41