flask播放视频网站

python代码:

# -*- coding: utf-8 -*-
from flask import Flask,request,render_template

app = Flask(__name__)

@app.route("/",methods=['GET'])  
def hello_world():
    list = [
    	'1 a.mkv',
    	'[Kamigami] Psycho-Pass - 01 [1280x720 x264 AAC Sub(CH,JP)].mkv',
    	'[Kamigami] Psycho-Pass - 02 [1280x720 x264 AAC Sub(CH,JP)].mkv'
    ]
    return render_template("index.html",list=list)

if __name__ == '__main__':
    app.run(debug=True,host='0.0.0.0',port=8000)

html代码:

<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>yz</title>
</head>
<body>
<video width="320" height="240" controls>
    <source src="{{ url_for('static',filename='[Kamigami] Psycho-Pass - 01 [1280x720 x264 AAC Sub(CH,JP)].mkv') }}" type="video/mp4">
</video>
{% for i in list %}
<video width="320" height="240" controls>
    <source src="{{ url_for('static',filename=i) }}" type="video/mp4">
</video>
{% endfor %}
</body>
<script>
</script>
</html>

 

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注