Walkyst / lavaplayer-fork

Apache License 2.0
174 stars 68 forks source link

Force YT HTTP stream to use the range header and reconnect #58

Closed devoxin closed 1 year ago

devoxin commented 2 years ago

This PR sets the maxSkipDistance in PersistentHttpStream to 0, which forces usage of the seekHard method, which sets the position and closes the connection.

The automatic retry mechanism re-opens the connection, however as YT supports the range header, means they do the seeking on their end, serving the file from the provided byte range (range=byteStart-byteEnd). This is how the YouTube player does seeking outside of pre-buffered ranges, and should provide more consistent and reliable seeking for YT tracks.

Walkyst commented 2 years ago

Actually this doesn't fix main issue, i'm looking into it too to resolve

Walkyst commented 2 years ago

Try this, most likely it is fixing seeking issue https://github.com/Walkyst/lavaplayer-fork/commit/31b736d0a6c6d218c5987ec9cc37a460476aa1e4

Also after some invistigation figured out that if range header have larger size than ~0-11862014 then it's throttled by YouTube