getHttpResponse(); $fileSize = $stream->getHeader('Content-Length'); $curSize = 0; while ($curSize < $fileSize[0]) { $newSize = $curSize + $video->downloader_options->http_chunk_size; if ($newSize > $fileSize[0]) { $newSize = $fileSize[0] - 1; } $response = $video->getHttpResponse(['Range' => 'bytes='.$curSize.'-'.$newSize]); $this->addStream(new YoutubeChunkStream($response)); $curSize = $newSize + 1; } } }