cakephp 3 response withFile and video tag

别来无恙 提交于 2019-12-11 18:29:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!