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