forked from hkc/cc-stuff
1
0
Fork 0
cc-stuff/mess/stream_video.py

12 lines
327 B
Python
Raw Normal View History

# x-run: sanic stream_video:app
from sanic import Request, Sanic, Websocket
app = Sanic("CCVideoStreamer")
@app.websocket("/stream")
async def ws_stream(req: Request, ws: Websocket):
with open("./video.cani", "r") as fp:
for line in fp:
await ws.send(bytes.fromhex(line.strip()))
await ws.close()