Fix the error of incomplete data loading on the Android emulator.

This commit is contained in:
vi-k 2021-09-03 16:12:30 +10:00
parent bba4ba97b6
commit f75767ea2a
1 changed files with 6 additions and 6 deletions

View File

@ -117,11 +117,11 @@ class YoutubeHttpClient extends http.BaseClient {
int errorCount = 0}) async* {
var url = streamInfo.url;
var bytesCount = start;
for (var i = start; i < streamInfo.size.totalBytes; i += 9898989) {
while (bytesCount != streamInfo.size.totalBytes) {
try {
final response = await retry(() {
final request = http.Request('get', url);
request.headers['range'] = 'bytes=$i-${i + 9898989 - 1}';
request.headers['range'] = 'bytes=$bytesCount-${bytesCount + 9898989 - 1}';
return send(request);
});
if (validate) {