mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 06:19:21 +00:00
feat(engine): parse data-vst-chain on audio elements
This commit is contained in:
@@ -573,3 +573,17 @@ describe("parseAudioElements — relative data-start resolution", () => {
|
||||
expect(track!.start).toBe(4);
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseAudioElements data-vst-chain", () => {
|
||||
it("captures the chain path when present", () => {
|
||||
const html = `<audio id="music" src="assets/bgm.mp3" data-start="0" data-end="10" data-vst-chain="fx/music.vstchain.json"></audio>`;
|
||||
const [el] = parseAudioElements(html);
|
||||
expect(el.vstChain).toBe("fx/music.vstchain.json");
|
||||
});
|
||||
|
||||
it("leaves vstChain undefined when absent", () => {
|
||||
const html = `<audio id="music" src="assets/bgm.mp3" data-start="0" data-end="10"></audio>`;
|
||||
const [el] = parseAudioElements(html);
|
||||
expect(el.vstChain).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -219,6 +219,7 @@ export function parseAudioElements(html: string): AudioElement[] {
|
||||
const mediaStartAttr = el.getAttribute("data-media-start");
|
||||
const layerAttr = el.getAttribute("data-layer");
|
||||
const volumeAttr = el.getAttribute("data-volume");
|
||||
const vstChain = el.getAttribute("data-vst-chain");
|
||||
return {
|
||||
id,
|
||||
src: el.getAttribute("src") as string,
|
||||
@@ -227,6 +228,7 @@ export function parseAudioElements(html: string): AudioElement[] {
|
||||
mediaStart: mediaStartAttr ? parseFloat(mediaStartAttr) : 0,
|
||||
layer: layerAttr ? parseInt(layerAttr) : 0,
|
||||
volume: volumeAttr ? parseFloat(volumeAttr) : 1.0,
|
||||
...(vstChain ? { vstChain } : {}),
|
||||
type,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -12,6 +12,8 @@ export interface AudioElement {
|
||||
layer: number;
|
||||
volume?: number;
|
||||
volumeKeyframes?: AudioVolumeKeyframe[];
|
||||
/** Project-relative path to a .vstchain.json effect chain (data-vst-chain). */
|
||||
vstChain?: string;
|
||||
type: "audio" | "video";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user