- Docs
- Parameters
- duration_mode
duration_mode
- Recordings
Control how a recording’s actions fit into its duration
How it works
Section titled “How it works”duration_mode decides what happens when a recording’s actions take more or less time than duration_ms.
| Mode | Actions finish early | Actions run long | Max duration_ms |
Max capture |
|---|---|---|---|---|
at_most |
Video ends when the actions finish | Cut off at duration_ms |
30,000 | 30 s |
fixed |
Keeps recording until duration_ms |
Cut off at duration_ms |
30,000 | 30 s |
at_least |
Keeps recording until duration_ms |
Keeps recording until the actions finish | 30,000 | 90 s |
target |
Video is slowed down to duration_ms |
Video is sped up to duration_ms |
90,000 | 90 s |
Values
Section titled “Values”at_most
Section titled “at_most”Records until the actions finish or duration_ms is reached, whichever comes first.
Always produces a video exactly duration_ms long. If the actions finish early, it keeps recording the page. If they run long, they’re cut off. Animations keep playing during the extra time, so you don’t need a trailing stall.
at_least
Section titled “at_least”Records for at least duration_ms, and keeps going until the actions finish, up to 90 seconds.
target
Section titled “target”Runs the actions to completion, up to 90 seconds of capture, then changes the playback speed so the video is exactly duration_ms long. A 40-second capture with "duration_ms": 20000 plays at 2× speed. It’s the only mode that allows duration_ms up to 90000.
Default behavior
Section titled “Default behavior”Defaults to at_most.
When to use each mode
Section titled “When to use each mode”| Mode | Best for |
|---|---|
at_most |
Scrolling walkthroughs. simple_scroll stops at the bottom, so short pages give short videos. |
fixed |
Timed animations and clips that need an exact length. |
at_least |
Click-throughs where every step must run, on pages whose speed you can’t predict. |
target |
Timelapse-style overviews of long pages, or an exact length when you can’t predict how long the actions take. |
Recording credits and billing
Section titled “Recording credits and billing”at_least and target use twice the credits of at_most and fixed, because the capture can run longer than duration_ms. A 10-second recording uses 3 credits in at_most or fixed mode, and 6 in at_least or target mode.
Example usage
Section titled “Example usage”Walkthrough that ends at the bottom
Section titled “Walkthrough that ends at the bottom”{ "url": "https://example.com/", "duration_ms": 15000, "actions": [{ "type": "simple_scroll" }]}Exact-length animation
Section titled “Exact-length animation”{ "html": "<h1>Version 2.0 is out.</h1>", "css": "h1 { opacity: 0; } .recording h1 { animation: reveal 1s both; } @keyframes reveal { to { opacity: 1; } }", "duration_ms": 5000, "duration_mode": "fixed", "actions": [{ "type": "execute_javascript", "script": "document.body.classList.add('recording');" }]}Speed up a long scroll
Section titled “Speed up a long scroll”{ "url": "https://example.com/changelog", "duration_ms": 20000, "duration_mode": "target", "actions": [{ "type": "simple_scroll", "ms_between_scrolls": 600 }]}Need help?
Talk to a human. Email support@htmlcsstoimage.com and we’ll help you get started.