12 lines
327 B
Python
12 lines
327 B
Python
|
# 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()
|