# phx_demo v0.1.1 - API Reference

## Modules

- [PhxDemo](PhxDemo.md): Automated, reproducible demo videos for Phoenix / LiveView apps.
- [PhxDemo.Audio](PhxDemo.Audio.md): Audio input for demos: `PhxDemo.Steps.upload_audio/4`,
`use_microphone/3`, `stop_microphone/1` and `use_camera(path, audio: true)`.
- [PhxDemo.Camera](PhxDemo.Camera.md): Simulated camera for demos (the machinery behind `PhxDemo.Steps.use_camera/3`,
`use_camera_image/2` and `stop_camera/1`).
- [PhxDemo.Captions](PhxDemo.Captions.md): Builds captions (SRT / WebVTT) and chapter metadata from a demo timeline.
- [PhxDemo.Case](PhxDemo.Case.md): ExUnit case template for demos.
- [PhxDemo.Drift](PhxDemo.Drift.md): Visual drift checks. Warns, never fails.
- [PhxDemo.Env](PhxDemo.Env.md): Pre-flight checks so a demo fails fast with a clear message instead of
recording a broken page.
- [PhxDemo.Fixtures](PhxDemo.Fixtures.md): Finds the files that `upload/4` and `drop_files/4` attach.
- [PhxDemo.LiveView](PhxDemo.LiveView.md): Waits for LiveView to settle so recordings don't capture half-updated pages
and steps don't fire before the socket is connected.
- [PhxDemo.Midi](PhxDemo.Midi.md): MIDI background music: `music: "song.mid"` is rendered to WAV with
[fluidsynth](https://www.fluidsynth.org/) and the WAV then goes through the
normal music pipeline (loop/trim, fades, ducking; see `PhxDemo.Render`).
- [PhxDemo.MusicGen](PhxDemo.MusicGen.md): Generated background music: `music: %{elevenlabs: "prompt"}` composes a
track with the [ElevenLabs Music API](https://elevenlabs.io/docs/api-reference/music/compose)
and the result then goes through the normal music pipeline (loop/trim,
fades, ducking; see `PhxDemo.Render`).
- [PhxDemo.Overlay](PhxDemo.Overlay.md): The in-page overlay (fake cursor, click ripples, spotlight). Headless
Chromium doesn't draw a cursor, so without this the video shows no pointer.
- [PhxDemo.Plan](PhxDemo.Plan.md): Maps a demo timeline onto its raw video, then decides what to keep.
- [PhxDemo.Render](PhxDemo.Render.md): Turns a demo's raw recording into shareable files with ffmpeg.
- [PhxDemo.Steps](PhxDemo.Steps.md): Pipeable demo steps. Each takes and returns the PhoenixTest session (`conn`),
so they mix freely with `visit/2`, `click_link/2`, `assert_has/3`, etc.
- [PhxDemo.TTS](PhxDemo.TTS.md): Text-to-speech for `PhxDemo.Steps.say/3`.
- [PhxDemo.TTS.ElevenLabs](PhxDemo.TTS.ElevenLabs.md): Narration with the ElevenLabs text-to-speech API.
- [PhxDemo.TTS.MacSay](PhxDemo.TTS.MacSay.md): Local, free TTS with macOS's `say` command. Good for drafts and CI on macOS.
- [PhxDemo.TTS.OpenAI](PhxDemo.TTS.OpenAI.md): Narration with OpenAI's text-to-speech API.
- [PhxDemo.TTS.Piper](PhxDemo.TTS.Piper.md): The default narrator: [Piper](https://github.com/OHF-Voice/piper1-gpl), a
free, open-source TTS that runs locally on macOS and Linux, so it needs no
API key and works in CI.
- [PhxDemo.Target](PhxDemo.Target.md): Turns demo targets into Playwright selectors.
- [PhxDemo.Timeline](PhxDemo.Timeline.md): Records what happened during a demo, and when, relative to the start of the
demo setup. That is a few milliseconds after the video starts, because the
browser context (and so the recording) is created first.
- [PhxDemo.Zoom](PhxDemo.Zoom.md): Auto-zoom from the cursor targets recorded by `glide/3`, and from the
target boxes of `:upload` events (`upload/4`, `drop_files/4`), so the view
holds on the file input or drop zone while the upload runs.

- Exceptions
  - [PhxDemo.Env.Error](PhxDemo.Env.Error.md)

## Mix Tasks

- [mix demo.record](Mix.Tasks.Demo.Record.md): Records every `demo` (see `PhxDemo.Case`) and renders the videos.
- [mix phx_demo.install](Mix.Tasks.PhxDemo.Install.md): Sets up phx_demo in a Phoenix app
- [mix phx_demo.piper.setup](Mix.Tasks.PhxDemo.Piper.Setup.md): Installs [Piper](https://github.com/OHF-Voice/piper1-gpl) into a private
Python virtualenv under the user cache directory and downloads a voice.
- [mix phx_demo.soundfont.setup](Mix.Tasks.PhxDemo.Soundfont.Setup.md): Downloads the [GeneralUser GS](https://www.schristiancollins.com/generaluser)
soundfont (about 32 MB) into the user cache directory, so `music: "x.mid"`
works without a system soundfont.

