Skip to content

feat: AutoPlay – hands-free radio station mode for continuous music generation#1160

Open
Copilot wants to merge 4 commits intomainfrom
copilot/feature-autoplay-checkbox
Open

feat: AutoPlay – hands-free radio station mode for continuous music generation#1160
Copilot wants to merge 4 commits intomainfrom
copilot/feature-autoplay-checkbox

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

Users had to manually click "Next Batch" and "Play" after every generated batch, breaking the continuous listening experience. AutoPlay eliminates both clicks by wiring audio ended events to automatic batch navigation and playback.

Changes

UI (result.py)

  • Added 🔁 AutoPlay checkbox to the batch navigation row (elem_id="acestep-autoplay")
  • Added elem_id="acestep-next-batch-btn" to the Next Batch button so JS can click it

Client-side logic (autoplay.js + autoplay.py)

New self-contained JS module injected via gr.Blocks(head=…):

  • Registers ended listeners on all audio players; when AutoPlay is checked and audio ends, clicks Next Batch immediately if enabled
  • If Next Batch is disabled (AutoGen still generating), polls every 500ms until the button becomes interactive, then clicks it — this is what enables the true "radio station" loop
  • Sets pendingAutoPlay = true only when autoplay triggers navigation (not manual clicks), so loadedmetadata on the first new audio slot auto-starts playback
  • Persists checkbox state to localStorage and restores it on page load via DOM polling
  • MutationObserver scoped to .gradio-container with requestAnimationFrame debounce to avoid per-render overhead; 3-minute poll timeout cleans up on generation failure

i18n

Added results.autoplay_label / results.autoplay_info to all five language files (en, zh, ja, he, pt).

Behaviour summary

Scenario Result
Audio ends, next batch ready Immediately navigates + auto-plays
Audio ends, AutoGen still generating Polls until ready, then navigates + auto-plays
AutoPlay unchecked mid-poll Poll cancelled, no navigation
User manually clicks Next Batch No auto-play (flag not set)
Page refresh Checkbox state restored from localStorage

Copilot AI linked an issue Apr 29, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 29, 2026 15:25
- Add autoplay_checkbox to the results section navigation row (result.py)
- Add elem_id 'acestep-next-batch-btn' to the Next Batch button
- Create autoplay.js: monitors audio 'ended' events, auto-clicks Next Batch
  when audio finishes (polls until enabled when AutoGen is generating), then
  auto-plays first slot when new audio loads; persists checkbox to localStorage
- Create autoplay.py: Python loader for the autoplay.js head script
- Inject autoplay JS into Gradio head in __init__.py
- Add i18n keys results.autoplay_label/autoplay_info to all 5 language files

Agent-Logs-Url: https://github.com/ace-step/ACE-Step-1.5/sessions/006413d6-3dff-4288-9443-64ee9e0f376c

Co-authored-by: ChuxiJ <[email protected]>
- Add comment explaining the 3-minute MAX_POLL_MS timeout rationale
- Remove expensive querySelectorAll('*') shadow-root scan; Gradio renders
  audio elements in the main document tree so flat querySelectorAll suffices
- Limit MutationObserver to .gradio-container (falls back to documentElement)
  to reduce observer scope; add comment explaining rAF debounce rationale

Agent-Logs-Url: https://github.com/ace-step/ACE-Step-1.5/sessions/006413d6-3dff-4288-9443-64ee9e0f376c

Co-authored-by: ChuxiJ <[email protected]>
Copilot AI changed the title [WIP] Add AutoPlay checkbox for AutoGen functionality feat: AutoPlay – hands-free radio station mode for continuous music generation Apr 29, 2026
Copilot AI requested a review from ChuxiJ April 29, 2026 15:29
@ChuxiJ ChuxiJ marked this pull request as ready for review April 30, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: AutoPlay

2 participants