feat: Audio Preview Player — browse and play WAV samples via Web Audio API
Issue: #9 Backend: - GET /api/list-wavs?dir=<path> — lists .wav files in a directory - GET /wavs/<file> — static file serving from ./output/wavs Web UI: - WAV Browser section with path input + Browse button - AudioContext-based playback (zero deps) — progress bar, time display - WAV file grid with Play buttons, active item highlighting Tests: - 3 new tests for handleListWavs (wav files, empty dir, nonexistent dir) - Fix TestFindAkaiutil: add t.Chdir(tmp) so relative path lookups don't accidentally find the repo's third_party/akaiutil/akaiutil binary
This commit is contained in:
@@ -205,4 +205,109 @@ h2 {
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
color: var(--text2);
|
||||
}
|
||||
|
||||
.wav-controls {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.wav-controls input {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid var(--bg3);
|
||||
border-radius: var(--radius);
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
}
|
||||
.wav-controls button {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wav-player {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.now-playing {
|
||||
font-size: 13px;
|
||||
color: var(--green);
|
||||
margin-bottom: 6px;
|
||||
min-height: 18px;
|
||||
}
|
||||
|
||||
.audio-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.audio-progress {
|
||||
flex: 1;
|
||||
height: 6px;
|
||||
background: var(--bg3);
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.audio-progress-fill {
|
||||
height: 100%;
|
||||
background: var(--green);
|
||||
border-radius: 3px;
|
||||
width: 0%;
|
||||
transition: width 0.1s;
|
||||
}
|
||||
|
||||
#wav-time {
|
||||
font-size: 12px;
|
||||
color: var(--text2);
|
||||
min-width: 40px;
|
||||
}
|
||||
|
||||
.wav-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.wav-item {
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--bg3);
|
||||
border-radius: var(--radius);
|
||||
padding: 10px 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.wav-item:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
.wav-item.playing {
|
||||
border-color: var(--green);
|
||||
background: rgba(78, 204, 163, 0.1);
|
||||
}
|
||||
.wav-item .wav-name {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.wav-item .wav-play-btn {
|
||||
background: var(--accent2);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 4px 10px;
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
}
|
||||
Reference in New Issue
Block a user