无法使用Flask播放HTML5视频 [英] Can't play HTML5 video using Flask

查看:658
本文介绍了无法使用Flask播放HTML5视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



视频播放器不会流式传输文件,并显示错误(看下面的截图)。我无法找到它是什么错误的日志。





有没有我失踪的日志消息?是什么原因造成的,如何解决?解决方案

开发服务器默认运行在单线程模式,这意味着它可以一次只能处理一个请求。您一次请求两个文件的流,.m3u8和.ts。您可以传递 threaded = True processes = value大于1 app.run 来允许一次处理多个请求,但是伴随着它自己的问题。一般而言,开发服务器似乎在流式传输html5视频和音频方面存在问题。真正的解决方案是使用实际的服务器,如Nginx或Apache来提供媒体文件。


I'm using Flask to serve .m3u8 and .ts files to simulate a vod stream.

The video player does not stream the file and shows an error (see the screenshot below). I can't find a log of what error it is.

Is there a log message somewhere that I'm missing? What is causing this and how can I fix it?

解决方案

The development server runs in single threaded mode by default, meaning it can only handle one request at a time. You are requesting streams of two files at once, the .m3u8 and the .ts. You can pass threaded=True or processes=value greater than 1 to app.run to allow handling of multiple requests at once, but that comes with it's own problems. The development server in general seems to have problems streaming html5 video and audio. The real solution is to use an actual server such as Nginx or Apache to serve the media files.

这篇关于无法使用Flask播放HTML5视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆