视频平台。。。。 。

news/2024/10/17 22:24:46/

1.py 读取图片视频流
from flask import Flask
from flask import render_template
import os
images_path_list=[‘D:\imgs\’+filename for filename in os.listdir(‘D:\imgs\’) if filename.endswith(‘.jpg’)]
print(images_path_list)
def return_img_stream(img_local_path):
import base64

with open(img_local_path,'rb') as f:img_stream=f.read()img_stream = base64.b64encode(img_stream).decode()#print(img_stream)#print(type(img_stream))
return img_stream

page_list=range(len(images_path_list)//10+1)
app = Flask(name)

@app.route(‘/’)
def hello_world():
img_streams=[]
for img_path in images_path_list:
#img_path=‘D:\imgs\tec.jpg’
img_stream = return_img_stream(img_path)
img_streams.append(img_stream)
return render_template(‘index.html’,img_streams=img_streams,page_list=page_list)
@app.route(‘/movie’)
def movie1():
img_path=‘D:\imgs\m1.mp4’
img_stream = return_img_stream(img_path)
return render_template(‘movie.html’,img_stream=img_stream)
@app.route(‘/images/int:page’)
def show_images(page):
print(page)
img_streams = []
# page=0
for img_path in images_path_list[page10:page10+10]:
# img_path=‘D:\imgs\tec.jpg’
img_stream = return_img_stream(img_path)
img_streams.append(img_stream)
return render_template(‘images.html’, img_streams=img_streams, page_list=page_list)
if name == ‘main’:
app.run(host=(0,0,0,0),debug=True)
2.前端显示页面
index.html
在这里插入图片描述

movie.html
关键部分在于:

![在这里插入图片描述](https://img-blog.csdnimg.cn/e2422da8388c4c3eb70a9d17b6cab5ab.png) 3.img.html ![在这里插入图片描述](https://img-blog.csdnimg.cn/63d555032bbf4f6db3e665779b6b299d.png)

http://www.ppmy.cn/news/746961.html

相关文章

Mybatis-SQL分析组件 | 京东云技术团队

背景 大促备战,最大的隐患项之一就是慢sql,带来的破坏性最大,也是日常工作中经常带来整个应用抖动的最大隐患,而且对sql好坏的评估有一定的技术要求,有一些缺乏经验或者因为不够仔细造成一个坏的sql成功走到了线上&am…

【Bootstrap 学习笔记】bootstrap css 布局容器 栅格系统

1 概述 1&#xff09;HTML 5 文档类型 Bootstrap 使用到的某些 HTML 元素和 CSS 属性需要将页面设置为 HTML5 文档类型。 <!DOCTYPE html> <html lang"zh-CN">... </html>2&#xff09;移动设备优先 Bootstrap 是移动设备优先的。为了确保适当…

记一次上电不当引起的开机花屏

调试一款BOE lvds屏幕时&#xff0c;出现开机花屏(必现)&#xff0c;休眠唤醒后正常。 查看开机时5v ldo的波形如下(异常波形维持3s以上&#xff0c;下面的图是改善后的&#xff0c;减低到420ms&#xff0c;开机的瞬间无法直接控制到该gpio) 相应的ldo电路如下 由于使能脚没有…

WIN10 启动后花屏

WIN10 启动后花屏 解决方案 win10里&#xff0c;右键点击开始按钮&#xff0c;在菜单中选择“控制面板”&#xff0c;然后&#xff0c;控制面板 - 硬件和声音 - 电源选项 - 更改电源按钮的功能 - 更改当前不可用的设置 - 取消“启用快速启动”&#xff0c;点击“保存修改”按…

Win7系统开机花屏处理方法

我们日常在对电脑的使用过程中&#xff0c;经常都会遇到这样或那样的问题。比如说win7开机花屏&#xff0c;当遇到这个问题时该如何解决呢&#xff1f;别着急还有小编在呢&#xff0c;接下来我就来给大家详细的介绍一下Windows7系统开机花屏如何处理。 windows7系统开机花屏怎么…

Ubuntu19.04或Ubuntu20.04版本安装后开机花屏的解决办法

Ubuntu19.04或Ubuntu20.04版本安装后开机花屏的解决办法 注意&#xff1a;我是笔记本电脑&#xff0c;解决办法是我无意间发现的&#xff0c;本人啥都不懂&#xff0c;可能只对于本人电脑有效 首先花屏是这个样子的&#xff1a;很多条横杠&#xff08;甚至比图中的更多&#…

安装ubuntu出现花屏_ubuntu安装成功,开机花屏问题

解释&#xff1a;此方法本人经过测试并没有成功【文章转自CSDN】&#xff0c;由于时间有限把这个问题记录一下有空会继续测试&#xff0c;抛砖引玉…… 题描述&#xff1a; ubuntu正常开机花屏&#xff0c;进不入登录界面。从恢复模式进入没有问题。首先说下本人的是NVIDIA的显…

virtualBox ubuntu 虚拟机开机之后界面花屏、黑屏等处理方法

virtualBox ubuntu 虚拟机开机之后界面花屏、黑屏等处理方法 有时候更新完windows之后就会出现这种现象&#xff0c;有可能是两个原因&#xff1a; 1、显卡驱动问题 2、ubuntu无法正常加载desktop ** 解决办法&#xff1a; 1、首先 我们要进入命令行界面 按下 CtrlF1&#…