codealchemist / youtube-audio-server

Easily stream and download audio from YouTube.
75 stars 32 forks source link

Seeker is not working #10

Closed edwinharly closed 5 years ago

codealchemist commented 5 years ago

Able to reproduce on Chrome 70.0.3538.67. Works OK on Firefox 61.0.2. All on OSX.

Will investigate what's going on on Chrome. Thanks for reporting.

codealchemist commented 5 years ago

Seeking doesn't work on Chrome because we're just piping the mp3 stream into the express response. Chrome needs a partial response with byte ranges to properly do seeking. Wondering why this is not the case for Firefox...

I've found an express middleware that implements partial responses: https://www.npmjs.com/package/send-seekable

But... I wasn't able to find a performant solution to properly implement it since we need to know the total amount of bytes that will be transferred before sending the response.

I've played converting the stream to a buffer but it is too costly and takes too long to respond. I accept suggestion to properly do this in a performant way.

Thx!

codealchemist commented 5 years ago

The new endpoint /chunk/[videoId] allows chunked responses that will allow seeking to work on Google Chrome.

See #17. Thx!