Streaming hls

This commit is contained in:
2024-04-24 20:31:35 +02:00
parent 439c5c753c
commit 5e810d23ab
2 changed files with 13 additions and 4 deletions
+4 -4
View File
@@ -14,8 +14,7 @@ from logging import handlers
from pathlib import Path
from platform import uname
from sys import platform
from flask import Flask, jsonify, redirect, request, send_from_directory
from flask import Flask, jsonify, redirect, request, send_from_directory, render_template
from waitress import serve
HOST_ADDRESS = "192.168.1.15"
@@ -246,8 +245,9 @@ def stream_music():
:return: A JSON response containing a key "music_file_list" with the value of the variable `music_file_list`.
"""
return send_from_directory("/tmp/hls", "stream.m3u8")
#return send_from_directory("/tmp/hls", "stream.m3u8")
return render_template("stream.html")
@app.route("/<string:file_name>")
def stream(file_name):
@@ -260,10 +260,10 @@ def stream(file_name):
Returns:
Response: The response containing the streamed file.
"""
# trunk-ignore(bandit/B108)
video_dir = "/tmp/hls"
return send_from_directory(video_dir, file_name)
@app.route("/stream_mp3", methods=["GET"])
def stream_music_mp3():
"""
+9
View File
@@ -0,0 +1,9 @@
<html>
<head>
<title>HTTP Live Streaming Example</title>
</head>
<body>
<video src="/tmp/hls/stream.m3u8" height="300" width="400">
</video>
</body>
</html>