Fix blnak live stream

This commit is contained in:
proitlab committed 2026-07-11 10:36:40 +07:00
1 parent d93ee99c1f
commit 6afffb2184
2 files changed
+12 -3

No files matched your search

+6
View File
@@ -56,6 +56,12 @@ def api_live_video():
try:
with open(LIVE_STREAM_FRAME_PATH, "rb") as f:
jpeg = f.read()
if not jpeg or len(jpeg) < 2 or jpeg[:2] != b"\xff\xd8":
consecutive_fails += 1
if consecutive_fails >= MAX_FAILS:
return
time.sleep(0.05)
continue
consecutive_fails = 0
yield (b"--frame\r\n"
b"Content-Type: image/jpeg\r\n\r\n" + jpeg + b"\r\n")