feat: Make streaming optional when stream mode is enabled

Closes #218
This commit is contained in:
Pierre Rudloff 2019-04-28 00:25:03 +02:00
parent 9313bc2230
commit b91fe78dcd
3 changed files with 8 additions and 2 deletions

View file

@ -240,7 +240,7 @@ class DownloadController extends BaseController
} }
if (count($videoUrls) > 1) { if (count($videoUrls) > 1) {
return $this->getRemuxStream($request, $response); return $this->getRemuxStream($request, $response);
} elseif ($this->config->stream) { } elseif ($this->config->stream && (isset($this->video->entries) || $request->getQueryParam('stream'))) {
return $this->getStream($request, $response); return $this->getStream($request, $response);
} else { } else {
if (empty($videoUrls[0])) { if (empty($videoUrls[0])) {

View file

@ -80,6 +80,11 @@
{/foreach} {/foreach}
</optgroup> </optgroup>
</select><br/><br/> </select><br/><br/>
{if $config->stream}
<input type="checkbox" name="stream" id="stream"/>
<label for="stream">{t}Stream the video through the server{/t}</label>
<br/><br/>
{/if}
{if $config->convertAdvanced} {if $config->convertAdvanced}
<input type="checkbox" name="customConvert" id="customConvert"/> <input type="checkbox" name="customConvert" id="customConvert"/>
<label for="customConvert">{t}Convert into a custom format:{/t}</label> <label for="customConvert">{t}Convert into a custom format:{/t}</label>

View file

@ -67,7 +67,7 @@ class DownloadControllerTest extends ControllerTest
$this->assertRequestIsOk( $this->assertRequestIsOk(
'download', 'download',
['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU'] ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'stream' => true]
); );
} }
@ -89,6 +89,7 @@ class DownloadControllerTest extends ControllerTest
[ [
'url' => 'https://twitter.com/verge/status/813055465324056576/video/1', 'url' => 'https://twitter.com/verge/status/813055465324056576/video/1',
'format' => 'hls-2176', 'format' => 'hls-2176',
'stream' => true,
] ]
); );
} }