Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

php - cakephp 3 response withFile and video tag

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...