Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[Proposal] Port Android MediaElement from Exoplayer to Media3

Open TheCodeTraveler opened this issue 1 year ago • 7 comments

Feature name

Port Android MediaElement from Exoplayer to Media3

Link to discussion

https://github.com/CommunityToolkit/Maui/discussions/1400

Progress tracker

  • [ ] Android Implementation
  • [ ] iOS Implementation
  • [ ] MacCatalyst Implementation
  • [ ] Windows Implementation
  • [ ] Tizen Implementation
  • [ ] Unit Tests
  • [ ] Samples
  • [ ] Documentation

Summary

This Proposal will replace Google's ExoPlayer library with Google's Media3 library for CommunuityToolit.Maui.MediaElement.

Google has provided an official migration guide: https://developer.android.com/guide/topics/media/media3/getting-started/migration-guide

Motivation

Google has officially deprecated ExoPlayer and recommends all developers to move to their new implementation, Media3: https://android-developers.googleblog.com/2023/03/media3-is-ready-to-play.html#:~:text=ExoPlayer%20is%20deprecated%2C%20long%20live%20ExoPlayer!&text=google.,make%20the%20transition%20to%20Media3.

It is unclear which version of Android will cease to support ExoPlayer, but we should prioritize porting MediaElement to Media3 before that happens

Detailed Design

TBD

We are unable to provide a detailed design until we have an Media3 library for .NET MAUI.

Usage Syntax

The public APIs for MediaElement will remain unchanged

Drawbacks

There is not currently a C# Binding for Media3.

I spoke with @martijn00, the owner/maintainer of BaseFlow/XamarinExoPlayer (the NuGet Package that CommunityToolkit.Maui.MediaElement currently uses for ExoPlayer bindings), and he has plans to look into it. Specifically, there is currently an open PR on the XamarinExoPlayer repo adding support for Media3.

I've added the https://github.com/CommunityToolkit/Maui/labels/blocked label until a Media3 Binding is available.

Alternatives

There are no alternatives. Media3 is now the only officially supported Media library for Android.

Unresolved Questions

Will XamarinExoPlayer merge the open Media3 Pull Request, or will they create a new library to support Media3?

Will @moljac create a new library for the Media3 bindings? https://github.com/xamarin/AndroidX/issues/710#issuecomment-1746442764

TheCodeTraveler avatar Nov 09 '23 21:11 TheCodeTraveler

Will @moljac create a new library for the Media3 bindings? xamarin/AndroidX#710 (comment)

Moljac was a good boy and started bindings in March:

https://github.com/xamarin/AndroidX/pull/779

I have 1 artifact with approx 50-60 errors to fix. I think this should not be too long.

moljac avatar Nov 10 '23 06:11 moljac

Update from @moljac on the Media3 binding:

Almost done. Few weird issues I am investigating, but...

https://github.com/xamarin/AndroidX/pull/779

TheCodeTraveler avatar Jan 04 '24 18:01 TheCodeTraveler

Review requested. Publishing expected in next day or two.

moljac avatar Mar 04 '24 09:03 moljac

https://github.com/xamarin/AndroidX/pull/779 has been merged.

ne0rrmatrix avatar Jul 30 '24 17:07 ne0rrmatrix

https://github.com/xamarin/AndroidX/issues/710#issuecomment-2258907630

giuseppenovielli avatar Jul 31 '24 07:07 giuseppenovielli

about 90 percent done with porting now https://github.com/CommunityToolkit/Maui/pull/2076

ne0rrmatrix avatar Jul 31 '24 09:07 ne0rrmatrix