feat: Add support for HTTP range requests when stream mode is enabled
Fixes #192
This commit is contained in:
parent
1d2617c917
commit
4cbc21de46
1 changed files with 13 additions and 1 deletions
|
@ -422,9 +422,21 @@ class FrontController
|
|||
$body = new Stream($stream);
|
||||
} else {
|
||||
$client = new Client();
|
||||
$stream = $client->request('GET', $video->url, ['stream' => true]);
|
||||
$stream = $client->request(
|
||||
'GET',
|
||||
$video->url,
|
||||
[
|
||||
'stream' => true,
|
||||
'headers' => ['Range' => $request->getHeader('Range')]
|
||||
]
|
||||
);
|
||||
$response = $response->withHeader('Content-Type', $stream->getHeader('Content-Type'));
|
||||
$response = $response->withHeader('Content-Length', $stream->getHeader('Content-Length'));
|
||||
$response = $response->withHeader('Accept-Ranges', $stream->getHeader('Accept-Ranges'));
|
||||
$response = $response->withHeader('Content-Range', $stream->getHeader('Content-Range'));
|
||||
if ($stream->getStatusCode() == 206) {
|
||||
$response = $response->withStatus(206);
|
||||
}
|
||||
$body = $stream->getBody();
|
||||
}
|
||||
if ($request->isGet()) {
|
||||
|
|
Loading…
Reference in a new issue