Skip to content

Commit 6ffeb5f

Browse files
committed
docs(skills): add-media image duration is optional and defaults to 3 seconds
1 parent 2dac3db commit 6ffeb5f

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎scripts/creator-editing-recipes.test.mjs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ test("the add-media recipe uses Studio's default durations", async () => {
9595
const { section, image } = await addMediaSection();
9696
const imageSecs = await studioDefaultSeconds("image");
9797
assert.ok(imageSecs, "could not read Studio's image default");
98-
assert.match(section, new RegExp(`Image: \`data-duration="${imageSecs}"\``));
98+
assert.match(section, new RegExp(`defaults to ${imageSecs} seconds`));
9999
assert.match(section, /`data-start` is enough/);
100100
assert.doesNotMatch(section, /ffprobe/);
101101
assert.match(section, /root composition's `data-duration` is at least/);
102-
assert.match(image, new RegExp(`data-duration="${imageSecs}"`));
102+
assert.doesNotMatch(image, /data-duration/);
103103
});
104104

105105
test("the add-media recipe uses Studio's full-frame geometry", async () => {
@@ -119,7 +119,9 @@ test("the add-media example carries every attribute Studio's drop writes", async
119119
const drop = await read("packages/studio/src/utils/timelineAssetDrop.ts");
120120
for (const attr of ['class="clip"', "data-start", "data-duration", "data-track-index"]) {
121121
assert.ok(drop.includes(attr), `Studio no longer writes ${attr}`);
122-
assert.ok(image.includes(attr.split("=")[0]), `doc example lacks ${attr}`);
122+
}
123+
for (const attr of ['class="clip"', "data-start", "data-track-index"]) {
124+
assert.ok(image.includes(attr), `doc example lacks ${attr}`);
123125
}
124126
});
125127

‎skills-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"files": 11
3535
},
3636
"hyperframes-core": {
37-
"hash": "fabf82bdd622403a",
37+
"hash": "7669da6ff87bf22b",
3838
"files": 11
3939
},
4040
"hyperframes-creative": {

‎skills/hyperframes-core/references/creator-editing-recipes.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,11 @@ Timeline math: pick the clips first and say which ones you picked (by id) if the
423423

424424
Write what Studio writes when a person drops a file on the timeline, so an agent-added clip behaves the same as a dropped one; the one difference is that video and audio need no `data-duration`. Studio's source of truth is `DEFAULT_TIMELINE_ASSET_DURATION` in `packages/studio/src/utils/studioHelpers.ts` and `buildTimelineAssetInsertHtml` in `packages/studio/src/utils/timelineAssetDrop.ts`; a test keeps this section equal to them.
425425

426-
- **Image: `data-duration="3"`.** A still has no length of its own, so it gets 3 seconds. Without a `data-duration` it never ends and stays on screen for the rest of the composition.
426+
- **Image: `data-duration` is optional and defaults to 3 seconds**, the same as a dropped image, because a still has no length of its own. Write it only for another length. A test keeps the 3 equal to the default in code.
427427
- **Video and audio: `data-start` is enough.** The length comes from the media itself. An authored `data-duration` shorter than the file is a trim, never a requirement; leave it out unless the request asks for a shorter clip.
428428
- **Start: the playhead or the requested time, never a silent `0`.** Studio's asset-panel Add uses the playhead time on track `0`; a drop uses the drop point.
429-
- Give every clip `id`, `class="clip"`, `data-start` and `data-track-index` (an image also `data-duration`). Video is `muted playsinline`; audio carries `data-volume="1"`.
430-
- Then make sure the root composition's `data-duration` is at least the clip's end (`data-start` plus its length: 3 for an image, the media's length for video and audio): Studio raises a declared root duration to cover the new clip, so an agent must too, or the clip lies past the end and never plays.
429+
- Give every clip `id`, `class="clip"`, `data-start` and `data-track-index`. Video is `muted playsinline`; audio carries `data-volume="1"`.
430+
- Then make sure the root composition's `data-duration` is at least the clip's end (`data-start` plus its length: 3 for an image unless you set another, the media's length for video and audio): Studio raises a declared root duration to cover the new clip, so an agent must too, or the clip lies past the end and never plays.
431431
- **Images and video fill the whole frame**: absolutely positioned at `left: 0; top: 0`, `width` and `height` equal to the composition's `data-width` and `data-height`, `object-fit: contain`. Studio does not know a dropped file's natural size, so it does not centre a smaller one.
432432
- `z-index` is the number of top-level clips already in that file plus one (at least `1`); later clips stack above earlier ones.
433433
- Several files dropped together share the drop's track and run end to end.
@@ -438,7 +438,6 @@ Write what Studio writes when a person drops a file on the timeline, so an agent
438438
class="clip"
439439
src="assets/photo.png"
440440
data-start="4"
441-
data-duration="3"
442441
data-track-index="1"
443442
style="position: absolute; left: 0px; top: 0px; width: 1920px; height: 1080px; object-fit: contain; z-index: 2"
444443
/>

0 commit comments

Comments
 (0)