Commit ·
8114dd9
1
Parent(s): e5d8fa8
Fix download: redirect to /videos static URL for streaming support
Browse files
modules/story_reels/router.py
CHANGED
|
@@ -3,7 +3,7 @@ Story Reels Router - API Endpoints
|
|
| 3 |
Consistent with Video Creator API pattern
|
| 4 |
"""
|
| 5 |
from fastapi import APIRouter, HTTPException
|
| 6 |
-
from fastapi.responses import FileResponse
|
| 7 |
import logging
|
| 8 |
|
| 9 |
from .schemas import (
|
|
@@ -86,17 +86,14 @@ async def get_story_status(video_id: str):
|
|
| 86 |
}
|
| 87 |
)
|
| 88 |
async def download_story_reel(video_id: str):
|
| 89 |
-
"""Download/stream a story reel"""
|
| 90 |
video_path = story_creator.get_video_path(video_id)
|
| 91 |
|
| 92 |
if not video_path or not video_path.exists():
|
| 93 |
raise HTTPException(status_code=404, detail="Video not found")
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
media_type="video/mp4",
|
| 98 |
-
filename=f"story_{video_id}.mp4"
|
| 99 |
-
)
|
| 100 |
|
| 101 |
|
| 102 |
@router.get("/story-reels",
|
|
|
|
| 3 |
Consistent with Video Creator API pattern
|
| 4 |
"""
|
| 5 |
from fastapi import APIRouter, HTTPException
|
| 6 |
+
from fastapi.responses import FileResponse, RedirectResponse
|
| 7 |
import logging
|
| 8 |
|
| 9 |
from .schemas import (
|
|
|
|
| 86 |
}
|
| 87 |
)
|
| 88 |
async def download_story_reel(video_id: str):
|
| 89 |
+
"""Download/stream a story reel - redirects to /videos static"""
|
| 90 |
video_path = story_creator.get_video_path(video_id)
|
| 91 |
|
| 92 |
if not video_path or not video_path.exists():
|
| 93 |
raise HTTPException(status_code=404, detail="Video not found")
|
| 94 |
|
| 95 |
+
# Redirect to /videos static mount for better streaming support
|
| 96 |
+
return RedirectResponse(url=f"/videos/{video_id}.mp4", status_code=302)
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
|
| 99 |
@router.get("/story-reels",
|