将视频文件从烧瓶服务器流式响应JS客户端
我正在使用后端上使用Python烧瓶创建“ YouTube克隆”,并在服务器端进行react JS,目前我需要从服务器上的文件中流式视频。
这就是我目前拥有的:
@app.route('/api/video/<string:video_id>')
def ShowVideo(video_id):
video = Video.query.filter_by(id = video_id).first() #"Video" is the video database (using SQLAlchemy)
if video is None:
return {"return":"401"} #video doesn't exist in database
#return ??
现在我有数据库中的视频ID和路径,我需要通过HTTP将其流到React JS网站上,
我看到人们使用OpenCV来流式传输,并将图像放在JS客户端中,但据我所知,它不能与计算机上的视频文件一起使用(我不确定,我不确定)。
我看到的另一件事是使用JS将视频直接发送到浏览器(例如 ,但是我认为这对我的情况不起作用)
有人有任何想法吗?
I am creating a "Youtube Clone" using Python Flask on the backend and React JS on the server side, and I currently need to stream the video from a file on the server.
This is what I currently have:
@app.route('/api/video/<string:video_id>')
def ShowVideo(video_id):
video = Video.query.filter_by(id = video_id).first() #"Video" is the video database (using SQLAlchemy)
if video is None:
return {"return":"401"} #video doesn't exist in database
#return ??
now I have the video id and path in the database, and I need to stream it over http to a React JS website
I've seen people using OpenCV to stream, and put an image in the JS client, but from what I've seen it does not work with a video file already on the computer (I can be mistaken, I'm not sure).
Another thing I've seen is using JS to send the video directly to the browser (like in this video, but I don't think this will work for my circumstances)
Does anyone have any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论