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>