# audio_controls


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## HTML IDs

HTML ID constants for audio control elements.

------------------------------------------------------------------------

### AudioControlIds

``` python

def AudioControlIds(
    args:VAR_POSITIONAL, kwargs:VAR_KEYWORD
):

```

*HTML ID constants for audio control elements.*

## Speed Selector Config

The speed selector itself is provided by
[`cjm_fasthtml_web_audio.components.render_speed_selector`](https://cj-mills.github.io/cjm-fasthtml-web-audio/components.html#render_speed_selector).
We only need a minimal `WebAudioConfig` here (namespace +
`enable_speed=True`) to drive its namespace-derived IDs and
`window.setReviewSpeed` / `window.cycleReviewSpeed*` wiring.

Defined locally (rather than reusing `REVIEW_AUDIO_CONFIG` from
`components.callbacks`) to avoid a circular import — `callbacks` imports
symbols from this module.

## Auto-Navigate Toggle

Toggle switch to enable automatic navigation to next segment when audio
playback completes.

------------------------------------------------------------------------

### render_auto_navigate_toggle

``` python

def render_auto_navigate_toggle(
    enabled:bool=False, # Whether auto-navigate is enabled
)->Any: # Auto-navigate toggle component

```

*Render auto-navigate toggle switch (client-side only, no server
persistence).*

## Combined Audio Controls

Renders both speed selector and auto-navigate toggle in a single
component.

------------------------------------------------------------------------

### render_audio_controls

``` python

def render_audio_controls(
    current_speed:float=1.0, # Current playback speed
    auto_navigate:bool=False, # Whether auto-navigate is enabled
    speed_url:str='', # URL for speed changes
    oob:bool=False, # Whether to render as OOB swap
)->Any: # Combined audio controls component

```

*Render combined audio controls (speed selector + auto-navigate
toggle).*

``` python
from fasthtml.common import to_xml
import re

# Container delegates speed selector to cjm-fasthtml-web-audio's render_speed_selector.
# Verify the container wires the library correctly at the integration boundary:
# namespace-derived IDs/functions present, persisted speed flows through, OOB attr applied.

html_default = to_xml(render_audio_controls(current_speed=1.0, auto_navigate=False))
assert 'sd-review-speed-select' in html_default   # Library-derived ID
assert 'setReviewSpeed' in html_default            # Library-derived onchange JS
assert 'sd-review-auto-nav-toggle' in html_default
assert 'sd-review-audio-controls' in html_default
assert 'hx-post' not in html_default               # speed_url empty → no HTMX
assert 'setReviewSpeed(1.0)' not in html_default   # speed==1.0 → sync script is no-op

html_wired = to_xml(render_audio_controls(current_speed=2.0, auto_navigate=True, speed_url="/x/speed"))
assert 'hx-post="/x/speed"' in html_wired
assert 'hx-trigger="change"' in html_wired
assert 'setReviewSpeed(2.0)' in html_wired  # Initial sync script
assert re.search(r'<option[^>]*value="2.0"[^>]*selected', html_wired)

html_oob = to_xml(render_audio_controls(auto_navigate=True, oob=True))
assert 'hx-swap-oob' in html_oob
assert 'sd-review-audio-controls' in html_oob

print('Review audio controls tests passed')
```

    Review audio controls tests passed
