diff --git a/backend/src/routers/signvideo.py b/backend/src/routers/signvideo.py index 4c65e08..b78b828 100644 --- a/backend/src/routers/signvideo.py +++ b/backend/src/routers/signvideo.py @@ -92,8 +92,8 @@ async def sign_video_thumbnail( # extract the thumbnail from the video bytes = extract_thumbnail(f"{settings.DATA_PATH}/{sign_video.path}") - return StreamingResponse(io.BytesIO(bytes), media_type="image/png") - + # return the thumbnail and make it cacheable for 60 days + return StreamingResponse(io.BytesIO(bytes), media_type="image/jpeg", headers={"Cache-Control": "max-age=5184000"}) @router.get("/{video_id}/", status_code=status.HTTP_200_OK) async def sign_video( @@ -114,8 +114,8 @@ async def sign_video( if not sign_video: raise BaseException("Sign video not found") - # return the video - return FileResponse(f"{settings.DATA_PATH}/{sign_video.path}", media_type="video/mp4") + # return the video and make it cacheable for 60 days + return FileResponse(f"{settings.DATA_PATH}/{sign_video.path}", media_type="video/mp4", headers={"Cache-Control": "max-age=5184000"}) class SignVideoUpdate(BaseModel):