windows: fix silent audio in unpackaged build (ms-appx -> file path)#3
Merged
Merged
Conversation
The app ships unpackaged (WindowsPackageType=None), so the ms-appx:///Assets/waterfall.mp3 URI has no package identity to resolve against and MediaPlayer silently fails to open the asset — the window shows but no sound plays. Load the asset by its real path next to the executable via AppContext.BaseDirectory, which resolves correctly in both packaged and unpackaged builds. Also add a MediaFailed handler so future open failures surface in Debug output instead of failing silently. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Bug
On Windows the app window opens but no audio plays.
Cause
AudioEngineloaded the bundled track viams-appx:///Assets/waterfall.mp3. The app ships unpackaged (WindowsPackageType=None), so thems-appx://scheme has no package identity to resolve against —MediaPlayersilently fails to open the source and stays quiet.Fix
AppContext.BaseDirectory(resolves correctly in both packaged and unpackaged builds).MediaFailedhandler so future open failures surface in Debug output instead of failing silently.Verification
Built locally (Release, x64, self-contained, unpackaged) and confirmed audio plays on Windows 10 (previously silent with the same build settings).
🤖 Generated with Claude Code