Skip to content

Commit

Permalink
Merge pull request #810 from blakeblackshear/fix-vod
Browse files Browse the repository at this point in the history
Fix proxying HLS
  • Loading branch information
dermotduffy authored Dec 15, 2024
2 parents 708d6b5 + b28aa59 commit 2e5e690
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions custom_components/frigate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from collections.abc import Mapping
import datetime
import logging
import os
from typing import Any, Optional, cast

from aiohttp import web
Expand Down Expand Up @@ -245,12 +246,14 @@ def _get_proxied_url(
url_path = f"api/events/{event_id}/snapshot.jpg"
elif path.endswith("clip.mp4"):
url_path = f"api/events/{event_id}/clip.mp4"
elif path.endswith("master.m3u8"):
url_path = f"vod/events/{event_id}/master.m3u8"
elif path.endswith("event_preview.gif"):
url_path = f"api/events/{event_id}/preview.gif"
elif path.endswith("review_preview.gif"):
url_path = f"api/review/{event_id}/preview"
elif path.endswith(".m3u8") or path.endswith(".ts"):
# Proxy event HLS requests to the vod module
file_name = os.path.basename(path)
url_path = f"vod/event/{event_id}/{file_name}"

if not url_path:
raise HASSWebProxyLibNotFoundRequestError
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def local_frigate(hass: HomeAssistant, aiohttp_server: Any) -> Any:
web.get("/api/events/event_id/thumbnail.jpg", response_handler),
web.get("/api/events/event_id/snapshot.jpg", response_handler),
web.get("/api/events/event_id/clip.mp4", response_handler),
web.get("/vod/events/event_id/master.m3u8", response_handler),
web.get("/vod/event/event_id/master.m3u8", response_handler),
web.get("/api/events/event_id/preview.gif", response_handler),
web.get("/api/review/event_id/preview", response_handler),
web.get(
Expand Down

0 comments on commit 2e5e690

Please sign in to comment.