I have a small project about streaming movie(720p). in Python Flask, Can anyone give me a example how to stream a video from a local disk in python flask. so its played on t
You might have come across manual solutions but Flask already has a helper function for you to stream media files with ease.
You need to use the send_from_directory
method from helpers.py
https://flask.palletsprojects.com/en/1.1.x/api/#flask.send_from_directory
you can use it like this:
@app.route("/movies", methods=["GET"])
def get_movie():
return send_from_directory(
app.config["UPLOAD_FOLDER"],
"your_movie.png",
conditional=True,
)