webapp fix added - #11
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR rewrites the embedded web UI/server in webapp.py to improve “phone browser over LAN” synced playback, shifting the browser playback implementation to HTML5 <audio> with SSE-driven session events and adding HTTP Range support for seeking/late-join sync. It also tweaks mp3_to_wav() in utils.py to accept an optional output path.
Changes:
- Replaced the embedded frontend (HTML/CSS/JS) with a new UI flow including an audio-unlock banner, SSE session handling, and file scanning/play controls.
- Added server-side audio streaming with HTTP Range support (
/audio/<session_id>) and a simplified status/files API. - Updated
mp3_to_wav()signature to make thewav_pathparameter optional.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| webapp.py | Major webapp/server + embedded frontend rewrite; adds Range-based audio streaming and SSE session notifications for browser playback. |
| utils.py | Adjusts mp3_to_wav() signature to make the output path optional (but currently needs a correctness fix). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+29
to
+32
| # Extensions listed in the UI and served to browsers. | ||
| # MP3/M4A are included: the browser decodes them natively, and the Node's | ||
| # host.py converts them to WAV for local sounddevice playback automatically. | ||
| AUDIO_EXTENSIONS = {".aiff", ".aif", ".flac", ".m4a", ".mp3", ".oga", ".ogg", ".wav"} |
Comment on lines
+789
to
+790
| start = int(s_str) if s_str.strip() else 0 | ||
| end = int(e_str) if e_str.strip() else total - 1 |
Comment on lines
+487
to
+490
| } else if (elapsed < audio.duration - 0.5) { | ||
| // Late join — seek into the track to stay in sync | ||
| const target = Math.min(elapsed + 0.15, audio.duration - 0.1); | ||
| audio.currentTime = target; |
| } | ||
| } catch (_) {} | ||
| }; | ||
| es.onerror = () => setTimeout(connectEvents, 3000); |
Comment on lines
+109
to
112
| def mp3_to_wav(mp3_path: str, wav_path: str = "") -> str: | ||
| wav_path = mp3_path.replace(".mp3", ".wav") | ||
| decoder = miniaudio.mp3_stream_file_iterative(mp3_path) | ||
| miniaudio.stream_file_wav(decoder, wav_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.