from fastapi import APIRouter from app.services.ffmpeg_service import stream_rtsp_to_url, reset_stream_time from linxyun.utils.result import Result, SysCodes from app.model import Stream router = APIRouter() @router.post("/get_stream") async def get_stream(camera_id: str, stream: Stream = Stream(), type: str="flv", ): return await stream_rtsp_to_url(camera_id, type, stream) @router.get("/looking/{camera_id}") async def looking(camera_id: str): status = await reset_stream_time(camera_id) if status is True: return Result.ok() else: return Result.error(SysCodes.OPERATE_FAIL)