Files
Vesktop/scripts/build/fileImportPlugin.mts
T
Vendicated 6f91ee1504 Fix hardware encoded streams not loading for viewers
Works around a Chromium bug. Moves the SPS and PPS before the IDR slice when a hardware encoder emits them at the end of a keyframe. Apply the correction before Discord encrypts outgoing video.

Assisted-by: GPT-6.2 Astra
2026-11-22 21:10:58 +01:00

21 lines
619 B
TypeScript

import { readFile } from "fs/promises";
import { resolve } from "path";
import type { Plugin } from "esbuild";
export const fileImportPlugin: Plugin = {
name: "file-import",
setup(build) {
build.onResolve({ filter: /^file:\/\// }, ({ path, resolveDir }) => ({
path: resolve(resolveDir, path.slice("file://".length)),
namespace: "file-import"
}));
build.onLoad({ filter: /.*/, namespace: "file-import" }, async ({ path }) => ({
contents: await readFile(path, "utf8"),
loader: "text",
watchFiles: [path]
}));
}
};