enricocid / Music-Player-GO

🎢🎼 Very slim music player πŸ‘¨β€πŸŽ€ 100% made in Italy πŸ•πŸŒ³πŸŒžπŸπŸŒ„
GNU General Public License v3.0
1.75k stars 213 forks source link

[FR]: Move to Media3 ExoPlayer #482

Open enricocid opened 1 year ago

enricocid commented 1 year ago

What feature would you like to see?

This will greatly simplify/improve MediaPlayerHolder.

https://developer.android.com/codelabs/exoplayer-intro#0

What kind of level is this feature request?

Advanced, a nightmare!

More info

New MediaPlayerHolder architecture/logics and a database to manage playlists and saved songs. That's why it is nightmare. Implementation of ExoPlayer is pretty simple.

Code of Conduct

OxygenCobalt commented 1 year ago

Use MediaItems to build queue and finally implement playlists https://github.com/enricocid/Music-Player-GO/issues/132

I think you might be misunderstanding what ExoPlayer means by playlists. It's really their way of saying "queue". You still need a DB to make actual playlists.

This is also tangentially related, but you can leverage the queue system to implement gapless playback too. Apparently this is an intrinsic behavior that is always attempted if you have a queue of media items in the player. It's something I've wanted to implement for awhile but the nature of translating between player and app state is really annoying.

How to implement reliable playlists? They should update when files are moved or deleted to update media id. There should be a method to update the database entries running a MediaStore query.

I personally use an ID system (not MediaStore IDs, those are inconsistent) to persist music.

Improve formats support(?)

ExoPlayer has really similar format support to native, aside from the addition of a few obscure formats. You also have to use extensions to get certain formats like FLAC working <Oreo.

Simplify Music model. The idea is to maintain few fields (id, albumid, startFrom?) and use MediaItem metadata in the UI.

ExoPlayer's metadata extractor is asynchronous and really slow. You probably need to keep a complex Music model and populate it with the extracted metadata during loads.

OxygenCobalt commented 1 year ago

Also, Media3 the MediaSession extension is awful. Apparently there are a ton of performance issues and gotchas because of the library's incessant desire to be hElpfUl and automate behavior that should really be handled by the app devs. I would seriously recommended rolling your own MediaSessionCompat controller and just using ExoPlayer components like I do.