用AI写网站(播放本地电影)


import cv2

from flask import Flask, render_template, send_file

app = Flask(__name__)

@app.route('/')

#在当前目录下新建一个名为templates的文件夹,将index.html放在这个文件夹下

def index():

    return render_template('index.html')

@app.route('/play_movie')

def play_movie():

    # 这里假设电影文件名为diamond.mp4,放在当前目录下

    movie_filename = 'diamond.mp4'

    return send_file(movie_filename)

if __name__ == '__main__':

    app.run(debug=True, host='0.0.0.0')


###index.html代码

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Remote Movie Player</title>

</head>

<body>

    <h1>Welcome to the Remote Movie Player!</h1>

    <p>Click below to play the movie:</p>

    <a href="/play_movie" target="_blank">Play Movie</a>

</body>

</html>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容