libvlcsharp icon indicating copy to clipboard operation
libvlcsharp copied to clipboard

Adding a MediaPlayerElement to Maui

Open jonx opened this issue 1 year ago • 15 comments

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

jonx avatar Jun 18 '24 18:06 jonx

The implementation is close to complete for Android but probably needs further testing.

  1. 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
  2. I replaced Messaging center by WeakEventManager
  3. The checks in the track list popup should be more constrained. The controls there need some refinement.
  4. The lock slider has some initial drawing issues. The icon only appears once you scroll once for some reason.
  5. 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.
  6. 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.

jonx avatar Jun 18 '24 18:06 jonx

image

Looking good so far :-)

mfkl avatar Jun 19 '24 12:06 mfkl

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.

mfkl avatar Jun 21 '24 13:06 mfkl

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?

jonx avatar Jun 25 '24 02:06 jonx

After some setup and deployment struggles, I managed to run the sample on an iOS device.

image

Buttons are present and working, just invisible.

mfkl avatar Jun 25 '24 19:06 mfkl

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.

mfkl avatar Jul 03 '24 21:07 mfkl

I'm thinking we can remove the Shared folder and namespace.

mfkl avatar Jul 05 '24 19:07 mfkl

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.

mfkl avatar Jul 05 '24 20:07 mfkl

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.

jonx avatar Jul 15 '24 19:07 jonx

hi, can I ask if you have an estimation in order to be live? thans a lot!

TheSundayDev avatar Jul 26 '24 12:07 TheSundayDev

Hello, I'll update the PR with the points discussed here by the end of next week. What platform are you interested in?

jonx avatar Jul 26 '24 17:07 jonx

Hi, MAUI ios and android for now. thanks

TheSundayDev avatar Jul 26 '24 17:07 TheSundayDev

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.

jonx avatar Jul 26 '24 20:07 jonx

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.

mfkl avatar Jul 30 '24 17:07 mfkl

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 ;)

TheSundayDev avatar Aug 14 '24 11:08 TheSundayDev

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.

jonx avatar Sep 28 '24 02:09 jonx