问题
I've used this code to send a video using an action in CakePHP:
$response = $this->response->withFile(WWW_ROOT.'Component.webm',['download' => false]);
and inside template:
<video class="img-responsive" controls>
<source src="<?= Router::url(['controller' => 'posts', 'action' => 'stream', $id]) ?>" />
</video>
everything works great in Microsoft Edge. But when I view the page inside Google Chrome and I start playing the video I cannot visit any other page of my site, until the video is downloaded completely, and after 30 seconds, if the video is not downloaded this error is shown:
Maximum execution time of 30 seconds exceeded
回答1:
I found the problem here: https://gist.github.com/ranacseruet/9826293#gistcomment-2141349
I used session_write_close();
on top of my action and now chrome works too.
来源:https://stackoverflow.com/questions/50195449/cakephp-3-response-withfile-and-video-tag