demowright 2.7.4 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as defaultOptions } from "./setup-c_UpOQ7a.mjs";
1
+ import { n as defaultOptions } from "./setup-CigOIkwA.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { execSync } from "node:child_process";
4
4
  import { mkdirSync, readdirSync } from "node:fs";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { r as AudioWriter, t as applyHud } from "./setup-c_UpOQ7a.mjs";
1
+ import { r as AudioWriter, t as applyHud } from "./setup-CigOIkwA.mjs";
2
2
  import { i as getGlobalTtsProvider, s as init_hud_registry } from "./hud-registry-Wfd4b4Nu.mjs";
3
3
  import { buildFfmpegCommand, createVideoScript, t as init_video_script } from "./video-script.mjs";
4
4
  import { annotate, caption, clickEl, hudWait, moveTo, moveToEl, narrate, prefetchTts, subtitle, typeKeys } from "./helpers.mjs";
@@ -731,9 +731,27 @@ function buildAndSaveAudioTrack(segments, outputPath, contextStartMs, browserAud
731
731
  * Finalize a video render job: run ffmpeg with the actual video path,
732
732
  * applying fade transitions, subtitle burn-in, and chapter metadata.
733
733
  */
734
+ function probeVideoDuration(filePath) {
735
+ try {
736
+ const out = execSync(`ffprobe -v error -show_entries format=duration -of csv=p=0 "${filePath}"`, { stdio: [
737
+ "ignore",
738
+ "pipe",
739
+ "ignore"
740
+ ] });
741
+ return parseFloat(out.toString()) || 0;
742
+ } catch {
743
+ return 0;
744
+ }
745
+ }
734
746
  function finalizeRenderJob(job, videoPaths) {
735
747
  for (const videoPath of videoPaths) try {
736
748
  if (!existsSync(videoPath)) continue;
749
+ let ssArgs = "";
750
+ if (existsSync(job.wavPath)) {
751
+ const videoDur = probeVideoDuration(videoPath);
752
+ const audioDur = probeVideoDuration(job.wavPath);
753
+ if (videoDur > 0 && audioDur > 0 && videoDur > audioDur + .5) ssArgs = `-ss ${(videoDur - audioDur).toFixed(3)}`;
754
+ }
737
755
  const filters = [];
738
756
  const transitions = job.timeline.filter((e) => e.kind === "transition");
739
757
  for (const t of transitions) {
@@ -751,6 +769,7 @@ function finalizeRenderJob(job, videoPaths) {
751
769
  const chapterArgs = existsSync(job.chaptersPath) ? `-i "${job.chaptersPath}" -map_metadata 2` : "";
752
770
  execSync([
753
771
  `ffmpeg -y`,
772
+ ssArgs,
754
773
  `-i "${videoPath}"`,
755
774
  `-i "${job.wavPath}"`,
756
775
  chapterArgs,
package/dist/setup.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as defaultOptions, t as applyHud } from "./setup-c_UpOQ7a.mjs";
1
+ import { n as defaultOptions, t as applyHud } from "./setup-CigOIkwA.mjs";
2
2
  export { applyHud, defaultOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "demowright",
3
- "version": "2.7.4",
3
+ "version": "2.8.0",
4
4
  "description": "Playwright video production plugin — cursor overlay, keystroke badges, TTS narration, and narration-driven video scripts for test recordings",
5
5
  "license": "MIT",
6
6
  "repository": {