forked from vfsfitvnm/ViMusic
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Range header to YouTube Music stream request (closes #290)
- Loading branch information
1 parent
6ecfb18
commit 6f1d8d6
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6f1d8d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Persist the slow download in bigger audio files (More than 10 Mb)
If, for example, the audio file is 30 MB, it should open 3 instances to precache the audio in 3 different chunks (So it should download in 3 parts of 10 Mb)
First downloader instance: Range=0-10000
Second downloader instance on queue: Range=10001-20000
Third downloader instance on queue: Range=20001=30000
6f1d8d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, the player already uses this kind of chunking, and I guess the download manager could use something like that, but parallelism is already used so it kind of defeats the purpose if we'd implement this, no?
6f1d8d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it defeats the purpose of the current implementation for files with less than 10 MB, because it takes the whole chunk, making the download really fast in this scenary. I think the current/main issue comes with files with more than 10MB size.
6f1d8d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using subrange and additional header, we could also modify the Url and add the parameter
format.url + "&range=0-${format.contentLength ?: 10000000}"
instead of
format.url
, fromval url = when (val status = body.playabilityStatus?.status) { "OK" -> format?.let {}
in fun createYouTubeDataSourceResolverFactory()6f1d8d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#290