Skip to content
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 for MediaElement Android Resource file not found #1537

Merged

Conversation

ne0rrmatrix
Copy link
Contributor

@ne0rrmatrix ne0rrmatrix commented Nov 19, 2023

Before you submit please check that this work relates to one of the following:

  • Bug fix for Android when opening a media source from Resources

Description of Change

Adds a check and modifies path for Resource if device type is Android

Linked Issues

Linked issue fixed:
#1399
#1433

Fixes

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

This adds a bool to check device type. If device type is android it modifies path to add the following prefix to path: "Assets/" This fixes a bug when selection Resource from device to playback video on android you get file not found. This fix is for android. Stock behavior is unchanged for all other devices.

@ne0rrmatrix
Copy link
Contributor Author

My test is not testing. I will revert unless you want me write out a multitarget test pattern and just test my item? Or i can start a discussion to introduce device specific tests. This might resolve some issues before they creep into codebase? Or expose issues that exist that have not been found. Maybe something like this: https://github.com/dotnet/maui/wiki/Testing

@bijington
Copy link
Contributor

@ne0rrmatrix thank you for the submission.

On the topic of device specific tests I would say ignore it for now. @pictos has this PR #1444 aimed at providing the ability to do it.

Running the test locally is enough for now. If you have the test already it might be worth opening another issue with the code so we don't miss it later

@ne0rrmatrix
Copy link
Contributor Author

@ne0rrmatrix thank you for the submission.

On the topic of device specific tests I would say ignore it for now. @pictos has this PR #1444 aimed at providing the ability to do it.

Running the test locally is enough for now. If you have the test already it might be worth opening another issue with the code so we don't miss it later

I'm going to revert the changes to test since after examining how testing works I determined my modification to test does not work as intended. That was an error by me in my understanding of testing in general.

Copy link
Member

@pictos pictos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ne0rrmatrix for this, I've a couple of comments

@ne0rrmatrix
Copy link
Contributor Author

ne0rrmatrix commented Nov 20, 2023

Added fix for #1538

A question for maintainers. Should I create a seperate PR for each thing I fix? Or can I lump a few fixes for related issue?
edit: Please keep this blocked for now. Working on an issue I introduced with fix.

@pictos
Copy link
Member

pictos commented Nov 20, 2023

@ne0rrmatrix, please create a separated PR. It's ways a good practice a PR per issue/bug, that way is easier to revert or find the PR that made the change (:

@ne0rrmatrix
Copy link
Contributor Author

@ne0rrmatrix, please create a separated PR. It's ways a good practice a PR per issue/bug, that way is easier to revert or find the PR that made the change (:

I removed the changes to deal with the other issue. I will work on it in a separate PR.

@ne0rrmatrix
Copy link
Contributor Author

I checked against main and the bug I was worried about exists already and I only noticed it when testing my fix. link to issue: #1545

That issue is unrelated to this so I guess this fix is good to go after review.

@pictos
Copy link
Member

pictos commented Nov 21, 2023

@ne0rrmatrix I don't how to test your changes, do you mind creating a sample on our sample app to validate it? Can be a new Page

@ne0rrmatrix
Copy link
Contributor Author

ne0rrmatrix commented Nov 21, 2023

@ne0rrmatrix I don't how to test your changes, do you mind creating a sample on our sample app to validate it? Can be a new Page

@pictos I have been using sample app from PR to test. Just load it in android emulator and navigate to media element. Choose resources from source drop down menu. If it works then my PR works. If you load main for the same test you will see it fail to load local resources from resource folder.

image

@pictos
Copy link
Member

pictos commented Nov 23, 2023

FYI I'll take a look during this weekend, asap

Copy link
Member

@pictos pictos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just changed the prop to be a field, since it's private it makes sense and using the .NET API.

Thanks for the fix @ne0rrmatrix

@pictos pictos enabled auto-merge (squash) November 27, 2023 02:32
@pictos pictos merged commit 4c87a9d into CommunityToolkit:main Nov 27, 2023
8 checks passed
@ne0rrmatrix ne0rrmatrix deleted the MediaElementResourceAndroidFix branch February 12, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants