Skip to content

Commit e7fbf83

Browse files
committed
docs: sync timer live activity readme
1 parent 5d7e37d commit e7fbf83

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

README.md

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ There are six types of Live Activities:
143143

144144
- `stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance
145145
- `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
146-
- `timer`: best for countdowns and elapsed timers, like benchmark runs, cooking timers, workouts, soak windows, and long-running jobs
147146
- `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
148147
- `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
149148
- `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
149+
- `timer`: best for countdowns and elapsed runtime, like benchmark runs, uploads, backups, transcodes, and long-running jobs
150150

151151
### Start & Update Live Activity
152152

@@ -251,25 +251,6 @@ activitysmith.live_activities.stream(
251251
)
252252
```
253253

254-
#### Timer
255-
256-
Use `duration_seconds` for a countdown. Omit `counts_down` for the default countdown behavior, or set `counts_down=False` for an elapsed timer.
257-
258-
```python
259-
activitysmith.live_activities.stream(
260-
"benchmark-run",
261-
content_state=content_state(
262-
title="Benchmark Run",
263-
subtitle="sampling performance",
264-
type="timer",
265-
duration_seconds=300,
266-
color="cyan",
267-
),
268-
)
269-
```
270-
271-
Later updates can change the title, subtitle, color, icon, or action without resetting the timer. Include `duration_seconds` again only when you want to restart the timer window from that update.
272-
273254
#### Alert
274255

275256
<p align="center">
@@ -293,6 +274,33 @@ activitysmith.live_activities.stream(
293274
)
294275
```
295276

277+
#### Timer
278+
279+
<p align="center">
280+
<img
281+
src="https://cdn.activitysmith.com/features/timer-live-activity.png"
282+
alt="Timer Live Activity showing a benchmark run countdown"
283+
width="680"
284+
/>
285+
</p>
286+
287+
```python
288+
activitysmith.live_activities.stream(
289+
"benchmark-run",
290+
content_state=content_state(
291+
title="Benchmark Run",
292+
subtitle="sampling",
293+
type="timer",
294+
duration_seconds=300,
295+
color="cyan",
296+
),
297+
)
298+
```
299+
300+
For a countdown, send `duration_seconds`. You can update `title`, `subtitle`, `color`, or any other visible field as the work changes. Leave `duration_seconds` out unless you want to change the timer.
301+
302+
To start at 00:00 and count up, set `counts_down: false` and leave out `duration_seconds`.
303+
296304
### End Live Activity
297305

298306
Call `end_stream(...)` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `auto_dismiss_minutes` to choose a different dismissal time, including `0` for immediate dismissal.

0 commit comments

Comments
 (0)