Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix: lint

Marc Diazd1087af63c16
diff --git a/src/lib/exporter/gifExporter.browser.test.ts b/src/lib/exporter/gifExporter.browser.test.ts
index db9b14467..1a7b63861 100644
--- a/src/lib/exporter/gifExporter.browser.test.ts
+++ b/src/lib/exporter/gifExporter.browser.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import sampleVideoUrl from "../../../tests/fixtures/sample.webm?url";
+import inflatedDurationVideoUrl from "../../../tests/fixtures/sample-inflated-duration.webm?url";
import { GifExporter } from "./gifExporter";
import type { ExportProgress } from "./types";
@@ -40,4 +41,33 @@ describe("GifExporter (real browser)", () => {
expect(finalizing.length).toBeGreaterThan(0);
expect(finalizing.at(-1)!.percentage).toBe(100);
});
+
+ it("exports successfully when container duration is inflated beyond actual content", async () => {
+ const exporter = new GifExporter({
+ videoUrl: inflatedDurationVideoUrl,
+ width: 320,
+ height: 180,
+ frameRate: 15,
+ loop: true,
+ sizePreset: "medium",
+ wallpaper: "#1a1a2e",
+ zoomRegions: [],
+ showShadow: false,
+ shadowIntensity: 0,
+ showBlur: false,
+ cropRegion: { x: 0, y: 0, width: 1, height: 1 },
+ onProgress: () => {
+ /**noop**/
+ },
+ });
+
+ const result = await exporter.export();
+
+ expect(result.success, result.error).toBe(true);
+ expect(result.blob).toBeInstanceOf(Blob);
+
+ const buf = await result.blob!.arrayBuffer();
+ const header = new TextDecoder().decode(new Uint8Array(buf, 0, 6));
+ expect(header).toMatch(/^GIF8[79]a/);
+ });
});
diff --git a/src/lib/exporter/videoExporter.browser.test.ts b/src/lib/exporter/videoExporter.browser.test.ts
index ec2b0f65e..460711144 100644
--- a/src/lib/exporter/videoExporter.browser.test.ts
+++ b/src/lib/exporter/videoExporter.browser.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import sampleVideoUrl from "../../../tests/fixtures/sample.webm?url";
+import inflatedDurationVideoUrl from "../../../tests/fixtures/sample-inflated-duration.webm?url";
import type { ExportProgress } from "./types";
import { VideoExporter } from "./videoExporter";
@@ -40,4 +41,33 @@ describe("VideoExporter (real browser)", () => {
expect(finalizing.length).toBeGreaterThan(0);
expect(finalizing.at(-1)!.percentage).toBe(100);
});
+
+ it("exports successfully when container duration is inflated beyond actual content", async () => {
+ const exporter = new VideoExporter({
+ videoUrl: inflatedDurationVideoUrl,
+ width: 320,
+ height: 180,
+ frameRate: 15,
+ bitrate: 1_000_000,
+ wallpaper: "#1a1a2e",
+ zoomRegions: [],
+ showShadow: false,
+ shadowIntensity: 0,
+ showBlur: false,
+ cropRegion: { x: 0, y: 0, width: 1, height: 1 },
+ onProgress: () => {
+ /**noop**/
+ },
+ });
+
+ const result = await exporter.export();
+
+ expect(result.success, result.error).toBe(true);
+ expect(result.blob).toBeInstanceOf(Blob);
+
+ const buf = await result.blob!.arrayBuffer();
+ const bytes = new Uint8Array(buf);
+ const ftyp = new TextDecoder().decode(bytes.slice(4, 8));
+ expect(ftyp).toBe("ftyp");
+ });
});