diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 042cbe91..f0ef16ea 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -188,8 +188,9 @@ "downloads": { "title": "Download", "disclaimer": "Downloads are taken directly from the provider. movie-web does not have control over how the downloads are provided.", - "hlsExplanation": "This media is a HLS stream which cannot be downloaded on movie-web.", + "hlsDisclaimer": "Downloads are taken directly from the provider. movie-web does not have control over how the downloads are provided. Please note that you are downloading an HLS playlist, this is intended for users familiar with advanced multimedia streaming.", "downloadVideo": "Download video", + "downloadPlaylist": "Download playlist", "downloadCaption": "Download current caption", "onPc": { "1": "On PC, click the download button then, on the new page, right click the video and select Save video as", diff --git a/src/components/player/README.md b/src/components/player/README.md index 404e138a..3e3bc0c6 100644 --- a/src/components/player/README.md +++ b/src/components/player/README.md @@ -12,7 +12,7 @@ These parts are internally used, they aren't exported. Do not use them outside o ### `/display` The display interface, abstraction on how to actually play the content (e.g Video element, chrome casting, etc) - - It must be completely seperate from any react code + - It must be completely separate from any react code - It must not interact with state, pass async data back with events ### `/internals` diff --git a/src/components/player/atoms/settings/Downloads.tsx b/src/components/player/atoms/settings/Downloads.tsx index 73bcf24a..4a7dcef2 100644 --- a/src/components/player/atoms/settings/Downloads.tsx +++ b/src/components/player/atoms/settings/Downloads.tsx @@ -15,6 +15,7 @@ function useDownloadLink() { const url = useMemo(() => { if (source?.type === "file" && currentQuality) return source.qualities[currentQuality]?.url ?? null; + if (source?.type === "hls") return source.url; return null; }, [source, currentQuality]); return url; @@ -42,6 +43,7 @@ export function DownloadView({ id }: { id: string }) { const { t } = useTranslation(); const downloadUrl = useDownloadLink(); + const sourceType = usePlayerStore((s) => s.source?.type); const selectedCaption = usePlayerStore((s) => s.caption?.selected); const subtitleUrl = useMemo( () => @@ -60,36 +62,61 @@ export function DownloadView({ id }: { id: string }) {
- router.navigate("/download/pc")}> - {t("player.menus.downloads.onPc.title")} - - router.navigate("/download/ios")}> - {t("player.menus.downloads.onIos.title")} - - router.navigate("/download/android")} - > - {t("player.menus.downloads.onAndroid.title")} - + {sourceType === "hls" ? ( + <> + + + - + + + + ) : ( + <> + router.navigate("/download/pc")}> + {t("player.menus.downloads.onPc.title")} + + router.navigate("/download/ios")} + > + {t("player.menus.downloads.onIos.title")} + + router.navigate("/download/android")} + > + {t("player.menus.downloads.onAndroid.title")} + - - - + - - + + + + + + + + )}
diff --git a/src/components/player/atoms/settings/SettingsMenu.tsx b/src/components/player/atoms/settings/SettingsMenu.tsx index 6e1f4d2f..14b3827f 100644 --- a/src/components/player/atoms/settings/SettingsMenu.tsx +++ b/src/components/player/atoms/settings/SettingsMenu.tsx @@ -37,6 +37,8 @@ export function SettingsMenu({ id }: { id: string }) { const source = usePlayerStore((s) => s.source); + const downloadable = source?.type === "file" || source?.type === "hls"; + return ( @@ -58,12 +60,10 @@ export function SettingsMenu({ id }: { id: string }) { - router.navigate( - source?.type === "file" ? "/download" : "/download/unable", - ) + router.navigate(downloadable ? "/download" : "/download/unable") } rightSide={} - className={source?.type === "file" ? "opacity-100" : "opacity-50"} + className={downloadable ? "opacity-100" : "opacity-50"} > {t("player.menus.settings.downloadItem")}