# Library playground

Everything below runs `@vid2context/core`, the library behind the CLI, the MCP server and the HTTP API, in your browser. Pick a context, change an option and the output follows. The box under each operation shows the exact code it ran; **Edit as code** copies it into the code box, where you can change anything.

On the HTML version of this page the playground runs `@vid2context/core` in your browser, in a Web Worker.

- Context: a fixture (`youtube-jNQXAC9IVRw`, `youtube-cCPsdFdlshc`), your own VideoContext JSON, or `GET /api/v1/context`.
- Operations: render to `text`, `json`, `markdown`, `srt`, `vtt`, `pack`, `ass`, `ttml`, `sbv`, `lrc`, `csv` with their options, `chunkTranscript`, `transcriptOutline`, `estimateTokens` for every format, `agentPrompt` and `cleanTranscript`.
- Your own code, with `core`, `context` and `secondary` in scope.

The default run, on Me at the zoo (`youtube-jNQXAC9IVRw`):

```js
return core.render(context, 'srt');
```

```srt
1
00:00:01,200 --> 00:00:03,360
All right, so here we are,
in front of the elephants

2
00:00:05,318 --> 00:00:07,974
the cool thing about these guys
is that they have really...

3
00:00:07,974 --> 00:00:12,616
really really long trunks

4
00:00:12,616 --> 00:00:14,367
and that's cool

5
00:00:14,421 --> 00:00:15,733
(baaaaaaaaaaahhh!!)

6
00:00:16,881 --> 00:00:18,881
and that's pretty much all there is to say
```
## What you can change

- **Context**: one of the real fixtures from the repo, a `VideoContext` you paste (the body of `GET /api/v1/context`), or one fetched live from this site's API or your own server.
- **Section and cleanup**: `getSection` cuts a time range or a chapter; `cleanTranscript` removes sound tags, rebuilds sentences and drops fillers. Both return new objects, so the raw transcript is never changed.
- **Operation**: `render` with each format's own options, `chunkTranscript`, `transcriptOutline`, `estimateTokens` across every format, `agentPrompt` and the cleanup report.
- **Your code**: an async function body with `core`, `context` and `secondary` in scope. It runs in a Web Worker with no access to this page.

The address bar keeps every choice and your code, so a copied link opens the same run. Pasted JSON stays on your machine and is never put in a link.

Token counts come from `estimateTokens`, a fast estimate made for budgets, not billing. [Read a long video by chapter](https://vid2context.com/docs/tutorials/long-videos.md) does the same with outlines and sections through the API.
