feat(Player): V2 playback command namespace + segment_duration fix + mode field

F-024 — V1 single-segment fix: when continuous_loop=false, total_duration is
now always overwritten with segment_duration regardless of what the client
sent. Sending total_duration:0 explicitly no longer bypasses the stop timer.
The play-once fallback in onMelodyLoopCompleted is tightened to only fire when
both segment_duration and total_duration are zero.

F-025 — V2 command namespace: PlaybackHandler now registers playback.play and
playback.stop instead of the old root-level playback command. LegacyAdapter
maps V1 { cmd:playback, action:play/stop } to the new V2 names so all deployed
clients keep working without changes.

F-026 — V2 mode field: setMelodyAttributes accepts a mode string (single /
timed / interval / infinite) with a duration field, replacing the ambiguous
continuous_loop + segment_duration + total_duration triplet. V1 timing fields
are still parsed when mode is absent.

Docs: feature-catalog.md entries F-024, F-025, F-026 added.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 10:30:05 +03:00
co-authored by Claude Sonnet 4.6
parent 7e8d91673f
commit 9f33f90ea9
5 changed files with 131 additions and 12 deletions
@@ -15,6 +15,10 @@ struct ActionEntry {
};
static const ActionEntry ACTION_MAP[] = {
// playback
{ "playback", "play", "playback.play" },
{ "playback", "stop", "playback.stop" },
// file_manager
{ "file_manager", "list_melodies", "files.list" },
{ "file_manager", "download_melody", "files.download" },
@@ -72,7 +76,6 @@ struct SimpleEntry {
static const SimpleEntry SIMPLE_MAP[] = {
{ "ping", "ping" },
{ "identify", "identify" },
{ "playback", "playback" },
};
static constexpr size_t SIMPLE_MAP_SIZE = sizeof(SIMPLE_MAP) / sizeof(SIMPLE_MAP[0]);