Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Two caveats worth stating plainly, since "everything is local" is the headline c
- **Screen Recorder**: Record your screen, window, or tab directly in the browser using the Screen Capture API.
- **GIF Maker**: Turn a series of images into an animated GIF. Reorder frames, set speed, loop, and resize.
- **Subtitle Studio**: Transcribe a video into word-timed subtitles with an on-device Whisper model, style the captions, and burn them into your video.
- **Subtitle Cinema Player**: Watch local videos with precisely timed SRT subtitles, a searchable transcript, cinema mode, and playback controls.
- **Video to Audio**: Extract audio from videos in your browser — MP3, M4A, OGG, or WAV out, with batch conversion, bitrate control, and optional trimming.
- **Video Converter**: Convert videos between MP4, WebM, MKV, AVI, MOV, and GIF in your browser — choose resolution, quality, and audio, trim a range, and watch live progress with cancel.

Expand Down
4 changes: 4 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,10 @@
"word-to-pdf": {
"name": "Word to PDF",
"description": "Convert a Word (.docx) document into a PDF using your browser's print dialog — text stays selectable and searchable, entirely in your browser. Styling is normalized, not pixel-exact."
},
"subtitle-cinema-player": {
"name": "Subtitle Cinema Player",
"description": "Watch local videos with perfectly timed SRT subtitles, a searchable transcript, cinema mode, and precise playback controls. Nothing is uploaded."
}
},
"categoriesShort": {
Expand Down
47 changes: 47 additions & 0 deletions src/__tests__/components/SubtitleCinemaPlayer.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { describe, expect, it } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import SubtitleCinemaPlayer from "@/components/SubtitleCinemaPlayer";

describe("SubtitleCinemaPlayer", () => {
it("loads and presents an SRT without requiring a video", async () => {
const user = userEvent.setup();
render(<SubtitleCinemaPlayer />);
const file = new File(["1\n00:00:00,000 --> 00:00:02,000\nHello cinema\n"], "captions.srt", { type: "text/plain" });
await user.upload(screen.getByLabelText("Choose SRT subtitle file"), file);
expect(await screen.findByText("1 cues loaded")).toBeInTheDocument();
expect(screen.getByText("SRT-only cinema mode — use play to step through your transcript.")).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Play" })).toBeInTheDocument();
});

it("exposes subtitle styling controls and highlights the active transcript cue", async () => {
const user = userEvent.setup();
render(<SubtitleCinemaPlayer />);
const file = new File(["1\n00:00:00,000 --> 00:02:00,000\nActive cue\n"], "captions.srt", { type: "text/plain" });
await user.upload(screen.getByLabelText("Choose SRT subtitle file"), file);
expect(screen.getByLabelText("Subtitle text size")).toBeInTheDocument();
expect(screen.getByLabelText("Subtitle text color")).toBeInTheDocument();
expect(screen.getByLabelText("Subtitle background color")).toBeInTheDocument();
expect(screen.getByLabelText("Subtitle background opacity")).toBeInTheDocument();
expect(screen.getByLabelText("Subtitle position")).toBeInTheDocument();
expect(screen.getByLabelText("Subtitle font family")).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: /Active cue/ }));
expect(screen.getAllByText("Active cue")[1].closest("button")).toHaveClass("text-primary");
});

it("supports dedicated SRT seek buttons and keyboard shortcuts", async () => {
const user = userEvent.setup();
render(<SubtitleCinemaPlayer />);
const file = new File(["1\n00:00:00,000 --> 00:00:20,000\nLong cue\n"], "captions.srt", { type: "text/plain" });
await user.upload(screen.getByLabelText("Choose SRT subtitle file"), file);

await user.click(screen.getByRole("button", { name: "Seek forward 5 seconds" }));
expect(screen.getByLabelText("Video progress")).toHaveValue("5");
await user.keyboard("{ArrowLeft}");
expect(screen.getByLabelText("Video progress")).toHaveValue("4");
await user.keyboard("{Shift>}{ArrowRight}{/Shift}");
expect(screen.getByLabelText("Video progress")).toHaveValue("9");
await user.click(screen.getByRole("button", { name: "Seek backward 1 second" }));
expect(screen.getByLabelText("Video progress")).toHaveValue("8");
});
});
15 changes: 15 additions & 0 deletions src/__tests__/lib/srt.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { describe, expect, it } from "vitest";
import { activeCue, parseSrt, parseSrtTimestamp } from "@/lib/subtitles/srt";

describe("SRT timing", () => {
it("parses millisecond timestamps exactly", () => expect(parseSrtTimestamp("01:02:03,450")).toBe(3723.45));
it("parses multiline cues and ignores malformed blocks", () => {
const cues = parseSrt("1\n00:00:01,000 --> 00:00:02,500\nHello\nworld\n\nbad\nno timing");
expect(cues).toEqual([{ id: "1", start: 1, end: 2.5, text: "Hello\nworld" }]);
});
it("applies offset while choosing the active cue", () => {
const cues = parseSrt("1\n00:00:01,000 --> 00:00:02,000\nHello");
expect(activeCue(cues, 0.6, 0.5)?.text).toBe("Hello");
expect(activeCue(cues, 2, 0.5)).toBeUndefined();
});
});
9 changes: 9 additions & 0 deletions src/app/tools/subtitle-cinema-player/opengraph-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { generateToolOgImage, ogSize, ogContentType } from "@/lib/og-image";

export const alt = "subtitle-cinema-player | BrowseryTools";
export const size = ogSize;
export const contentType = ogContentType;

export default function Image() {
return generateToolOgImage("subtitle-cinema-player");
}
5 changes: 5 additions & 0 deletions src/app/tools/subtitle-cinema-player/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import SubtitleCinemaPlayer from "@/components/SubtitleCinemaPlayer";
import { generateToolMetadata } from "@/lib/metadata";

export const metadata = generateToolMetadata("/tools/subtitle-cinema-player");
export default function SubtitleCinemaPlayerPage() { return <SubtitleCinemaPlayer />; }
9 changes: 9 additions & 0 deletions src/app/tools/subtitle-cinema-player/twitter-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { generateToolOgImage, ogSize, ogContentType } from "@/lib/og-image";

export const alt = "subtitle-cinema-player | BrowseryTools";
export const size = ogSize;
export const contentType = ogContentType;

export default function Image() {
return generateToolOgImage("subtitle-cinema-player");
}
Loading
Loading