-
Notifications
You must be signed in to change notification settings - Fork 473
Fix Windows Media Source bug with Packaged Apps #2609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Windows Media Source bug with Packaged Apps #2609
Conversation
…not work when running app as packaged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug on Windows where media playback fails in packaged mode by ensuring that the MediaElement correctly retrieves package resources.
- Added a null and whitespace check on ResourceMediaSource.Path before constructing the file path.
- Introduced two new helper classes (FileSystemUtils and AppInfoUtils) to retrieve and normalize the app package file path on Windows.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| MediaManager.windows.cs | Adds a Path check and uses PlatformGetFullAppPackageFilePath to correctly obtain a media file’s URI. |
| FileSystemUtils.windows.cs | Introduces file path normalization and retrieval methods to support packaged app scenarios. |
| AppInfoUtils.windows.cs | Implements app info utilities, including packaged app detection and version retrieval. |
dbbe7fb
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks James & Pedro!!
Description of Change
This fixes a bug in Windows where running an app in packaged mode results in media element not finding package resources and failing to playback Media Source from resource directory.
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information
To test this change run sample app in packaged and unpackaged mode and load local resource from drop down menu in sample app. It fixes an issue where running app as packaged results in failed media playback when choosing local resource from menu.
I added two Microsoft internal classes and I used null forgiveness operator. I know that is not allowed and would love it if someone could tell me if I should just rewrite the internals or just do the minimum to have it compile. Currently I only made the adjustments to let the app compile. I am happy to fix the use of null operator but I wanted feedback before modifying MS internals.