update
This commit is contained in:
@@ -8,7 +8,7 @@ from sqlalchemy.orm import Session
|
||||
from database import get_db
|
||||
from schemas import VideoCreate, VideoResponse
|
||||
from services import video_service
|
||||
from services.download_service import download_video
|
||||
from services.download_service import download_video, stream_video_live
|
||||
|
||||
router = APIRouter(prefix="/videos", tags=["videos"])
|
||||
|
||||
@@ -51,8 +51,10 @@ def stream_video(video_id: int, db: Session = Depends(get_db)):
|
||||
raise HTTPException(status_code=404, detail="Video nicht gefunden")
|
||||
|
||||
if not video.file_path:
|
||||
download_video(video.id, video.youtube_url)
|
||||
db.refresh(video)
|
||||
return StreamingResponse(
|
||||
stream_video_live(video.youtube_url),
|
||||
media_type="video/mp4",
|
||||
)
|
||||
|
||||
path = Path(video.file_path)
|
||||
if not path.exists():
|
||||
|
||||
Reference in New Issue
Block a user