@lalalic/markcut 3.2.32 → 3.2.34
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/package.json +1 -1
- package/src/mcp/map-footage.mjs +13 -3
- package/src/mcp/preview.mjs +1 -1
- package/src/mcp/remotion-app.bundle.js +31 -31
- package/src/player/bundle/player.js +4 -1
- package/src/types/Map.tsx +2 -1
- package/src/utils/route-legs.ts +5 -0
- package/tests/mcp-map-footage.test.ts +20 -1
- package/tests/route-legs.test.ts +12 -0
package/package.json
CHANGED
package/src/mcp/map-footage.mjs
CHANGED
|
@@ -10,6 +10,17 @@ export function findMapScenes(root){
|
|
|
10
10
|
return (root?.children||[]).filter(x=>x?.type==="scene"&&x.visible!==false&&
|
|
11
11
|
Array.isArray(x.children)&&x.children.some(child=>child.type==="map"));
|
|
12
12
|
}
|
|
13
|
+
/** Render only the map visual. Keep independent narration, ambience and BGM in the live preview. */
|
|
14
|
+
export function mapVisualOnlyScene(scene){
|
|
15
|
+
return {...structuredClone(scene),children:structuredClone((scene.children||[]).filter(child=>child.type==="map"))};
|
|
16
|
+
}
|
|
17
|
+
export function replaceMapWithFootage(scene,src,duration,index){
|
|
18
|
+
const visual={id:"map-footage-"+index,type:"video",visible:true,start:0,end:duration,
|
|
19
|
+
durationInSeconds:duration,src,volume:0};
|
|
20
|
+
// Do not drop independent speech/audio siblings when replacing a map leaf.
|
|
21
|
+
scene.children=(scene.children||[]).flatMap(child=>child.type==="map"?[visual]:[child]);
|
|
22
|
+
return scene;
|
|
23
|
+
}
|
|
13
24
|
export async function renderMapFootage(compiled,{generatedDir,key,onProgress=()=>{}}){
|
|
14
25
|
const root=compiled.root||compiled;
|
|
15
26
|
const scenes=findMapScenes(root);
|
|
@@ -28,7 +39,7 @@ export async function renderMapFootage(compiled,{generatedDir,key,onProgress=()=
|
|
|
28
39
|
const destination=join(generatedDir,name);
|
|
29
40
|
const temporary=await mkdtemp(join(tmpdir(),"markcut-map-render-"));
|
|
30
41
|
try{
|
|
31
|
-
const source=
|
|
42
|
+
const source=mapVisualOnlyScene(scene);
|
|
32
43
|
const isolated={...structuredClone(outputRoot),isSeries:true,children:[source],durationInSeconds:duration};
|
|
33
44
|
delete isolated.subtitle; // Global captions belong to the final video, not map footage.
|
|
34
45
|
const file=join(temporary,"props.json");
|
|
@@ -40,8 +51,7 @@ export async function renderMapFootage(compiled,{generatedDir,key,onProgress=()=
|
|
|
40
51
|
],{cwd:projectRoot,timeout:180000,maxBuffer:1024*1024*4,env:process.env});
|
|
41
52
|
if((await stat(join(temporary,name))).size<1024)throw Error("Empty map footage");
|
|
42
53
|
await rename(join(temporary,name),destination);
|
|
43
|
-
scene
|
|
44
|
-
durationInSeconds:duration,src:destination,volume:0}];
|
|
54
|
+
replaceMapWithFootage(scene,destination,duration,index);
|
|
45
55
|
rendered++;
|
|
46
56
|
}catch(error){
|
|
47
57
|
skipped++;
|
package/src/mcp/preview.mjs
CHANGED
|
@@ -205,7 +205,7 @@ export async function ensureVideoPreview(path, options = {}) {
|
|
|
205
205
|
const hash=createHash("sha256").update(validatedPath).update("\0")
|
|
206
206
|
.update(source).update("\0").update(JSON.stringify(referencedAssets)).update("\0").update(audio.audioSrc||"")
|
|
207
207
|
.update("\0").update(process.env.GOOGLE_MAPS_API_KEY||"")
|
|
208
|
-
.update("\0").update("map-footage-
|
|
208
|
+
.update("\0").update("map-footage-v4-custom-route-marker").digest("hex");
|
|
209
209
|
const id=hash;
|
|
210
210
|
let index={entries:[]};
|
|
211
211
|
try {index=JSON.parse(await readFile(indexFile,"utf8"));} catch{}
|