refactor: Use less confusing variable names in YoutubeStream
This commit is contained in:
parent
7bf2510dd2
commit
a1b401c148
1 changed files with 8 additions and 7 deletions
|
@ -24,16 +24,17 @@ class YoutubeStream extends AppendStream
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$stream = $video->getHttpResponse();
|
$stream = $video->getHttpResponse();
|
||||||
$fileSize = $stream->getHeader('Content-Length');
|
$contentLenghtHeader = $stream->getHeader('Content-Length');
|
||||||
$curSize = 0;
|
$curSize = 0;
|
||||||
while ($curSize < $fileSize[0]) {
|
|
||||||
$newSize = $curSize + $video->downloader_options->http_chunk_size;
|
while ($rangeStart < $contentLenghtHeader[0]) {
|
||||||
if ($newSize > $fileSize[0]) {
|
$rangeEnd = $rangeStart + $video->downloader_options->http_chunk_size;
|
||||||
$newSize = $fileSize[0] - 1;
|
if ($rangeEnd > $contentLenghtHeader[0]) {
|
||||||
|
$rangeEnd = $contentLenghtHeader[0] - 1;
|
||||||
}
|
}
|
||||||
$response = $video->getHttpResponse(['Range' => 'bytes='.$curSize.'-'.$newSize]);
|
$response = $video->getHttpResponse(['Range' => 'bytes='.$rangeStart.'-'.$rangeEnd]);
|
||||||
$this->addStream(new YoutubeChunkStream($response));
|
$this->addStream(new YoutubeChunkStream($response));
|
||||||
$curSize = $newSize + 1;
|
$rangeStart = $rangeEnd + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue