pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "attempt to fix subtitle download"

This reverts commit 30c80053b68b0d8ec3b1b4ce2e6edf6d14e983a6.

Pas 47a9e2a2 c12acf8c

+6 -26
+6 -26
src/components/player/atoms/settings/Downloads.tsx
··· 8 8 import { Icon, Icons } from "@/components/Icon"; 9 9 import { OverlayPage } from "@/components/overlays/OverlayPage"; 10 10 import { Menu } from "@/components/player/internals/ContextMenu"; 11 - import { convertSubtitlesToSrt } from "@/components/player/utils/captions"; 11 + import { convertSubtitlesToSrtDataurl } from "@/components/player/utils/captions"; 12 12 import { Transition } from "@/components/utils/Transition"; 13 13 import { useOverlayRouter } from "@/hooks/useOverlayRouter"; 14 14 import { usePlayerStore } from "@/stores/player/store"; ··· 125 125 const sourceType = usePlayerStore((s) => s.source?.type); 126 126 const selectedCaption = usePlayerStore((s) => s.caption?.selected); 127 127 const openSubtitleDownload = useCallback(() => { 128 - if (!selectedCaption?.srtData) return; 129 - 130 - try { 131 - // Convert subtitles to SRT format 132 - const srtContent = convertSubtitlesToSrt(selectedCaption.srtData); 133 - 134 - // Create a Blob with the SRT content 135 - const blob = new Blob([srtContent], { type: "application/x-subrip" }); 136 - const url = URL.createObjectURL(blob); 137 - 138 - // Create an anchor element for downloading 139 - const a = document.createElement("a"); 140 - a.href = url; 141 - a.download = "subtitles.srt"; 142 - document.body.appendChild(a); 143 - a.click(); 144 - 145 - // Clean up 146 - setTimeout(() => { 147 - document.body.removeChild(a); 148 - URL.revokeObjectURL(url); 149 - }, 100); 150 - } catch (error) { 151 - console.error("Error downloading subtitles:", error); 152 - } 128 + const dataUrl = selectedCaption 129 + ? convertSubtitlesToSrtDataurl(selectedCaption?.srtData) 130 + : null; 131 + if (!dataUrl) return; 132 + window.open(dataUrl); 153 133 }, [selectedCaption]); 154 134 155 135 const playerOptions = useMemo(