libvlcsharp
libvlcsharp copied to clipboard
Adding a MediaPlayerElement to Maui
Description of Change
This draft PR includes the implementation of a MediaPlayerElement for Maui. The changes include:
- Added new MediaPlayerElement control to LibVCLSharp.MAUI
- Added the sample LibVLCSharp.MAUI.Sample.MediaElement based on the Forms sample
- Added the sample LibVLCSharp.MAUI.Sample.MediaElement.Multiple that aims at showing how to style and use two instances of the control on the same page - but it's not yet doing that. Both controls are the same style currently
Issues Resolved
- fixes #637
Other Changes
- The SvgTintColorBehavior.cs was meant to change the color or the SVG icons but it's not working and can be ignored
Platforms Affected
- Core (all platforms)
- Android
Behavioral/Visual Changes
None
Before/After Screenshots
Not applicable
Testing Procedure
Not applicable
PR Checklist
- [X] Rebased on top of the target branch at time of PR
- [X] Changes adhere to coding standard
The implementation is close to complete for Android but probably needs further testing.
- I removed the dependance to AwesomeFont and replaced it with equivalent SVG files. The problem is that I can't change their color? I tried to implement a behavior to do that - it's in the project - but it's not working
- I replaced Messaging center by WeakEventManager
- The checks in the track list popup should be more constrained. The controls there need some refinement.
- The lock slider has some initial drawing issues. The icon only appears once you scroll once for some reason.
- This is only an Android port, but I suspect getting the iOS version should be quite easy given all we have here is cross-platform.
- The video starts playing before the player is visible. Maybe it's related to how the player is embedded.
It's possible the issues I mention were there already in the Xamarin version.
Please review and provide feedback.
Looking good so far :-)
I'm wondering whether it would be possible to keep the same code for XF and MAUI and just use #ifdef? Depends how much code is the same or different, besides namespaces. Also I don't know when we will drop XF support, so going through the effort of supporting both from a single code base might not be worth it. Not sure.
Will attempt to run the iOS sample next week, keep you posted.
I guess it's possible in theory but I'm not sure how you're going to manage this. The way I see this is that it's probably less work to maintain both projects rather than having to add all the #ifdefs. Maybe there is an easy way to do such thing that I don't know of?
After some setup and deployment struggles, I managed to run the sample on an iOS device.
Buttons are present and working, just invisible.
Managed to display the play/pause icons in iOS with a hack. https://github.com/mfkl/libvlcsharp/commit/66d3d528a795141391124c06e320c09acddc4012;
Still need to figure out how to include them transitively (from libvlcsharp.maui) as they were not present in the app bundle.
MAUI expects png references from XAML or C# as it translates the svgs.
The path from the generic theme appears to be from the app bundle, not the code project.
I'm thinking we can remove the Shared folder and namespace.
For the image issue on iOS, Maui is supposed to translate them into pngs during build with proper size options but there are various bugs preventing it from doing it transitively. With a BundleResource I managed to have them in the app bundle but they're not translated into pngs and iOS cannot read SVG natively...
So we might be better off sticking to FontAwesome for now, as XF was doing.
Alright, thanks for the review. I'll update the PR based on your comments and will revert back the Fontawesome removal with the hope we won't face the same issue with icons.
hi, can I ask if you have an estimation in order to be live? thans a lot!
Hello, I'll update the PR with the points discussed here by the end of next week. What platform are you interested in?
Hi, MAUI ios and android for now. thanks
Alright, in this case, if you're in a hurry, my PR code is working already and not much will change before the final version on Android. We're only having this bug on iOS that is not including the button icons from the library to the main project. I'm just going to revert to using fonts like the original xamarin was doing. Meaning you can potentially start integrating it in your project. If not, stay tuned for my update next week. Then it will probably take a little longer for the VLC# people to accept the PR.
hi, can I ask if you have an estimation in order to be live? thans a lot!
Hi, we do not provide delivery estimate for opensource work, it is released when it's ready. If you'd like to speed up the process, you may check out the PR's branch locally and help improve it by fixing the remaining issues. Thanks.
hi, can I ask if you have an estimation in order to be live? thans a lot!
Hi, we do not provide delivery estimate for opensource work, it is released when it's ready. If you'd like to speed up the process, you may check out the PR's branch locally and help improve it by fixing the remaining issues. Thanks.
Hi, I was just asking, I didn't want to push ;)
I'm closing this PR to sync my fork and create a new PR. @TheSundayDev, you're welcome to test the new PR. Feedback welcome.