MusicPlayer using glide, exo-player and dagger-hilt
- MainActivity
- HomeFragment
- SongFragment
- when app launches MainActivity will be shown first. The part above bottom bar in the MainActivity is HomeFragment. HomeFragment is the starting point of the app.
- SongFragment is responsible for displaying song detail page. User can change seekbar position by moving cursor over it.
MusicServiceConnectionis the class responsible for connecting ui and service.- In
MusicServiceConnectionwe callMediaBrowserCompat()which will Create a media browser for the specified media browse service. - we call
connect()along with it which will Connect to the media browse service. Internally, it binds to the service. - after
connect()is invoked callbacks provided toMediaBrowserCompatwill be called .i.e.MediaBrowserCompatConnectionCallback(). MediaControllerCompatis invoked inMediaBrowserCompatConnectionCallback.onConnected().MediaControllerCompatAllows an app to interact with an ongoing media session. Media buttons and other commands can be sent to the session. A callback may be registered to receive updates from the session, such as metadata and play state changes.MediaControllerCallbackwe listen to app interactions such as onPlaybackStateChanged, onMetadataChanged, etc. And update our ui accordingly.
Architecture:



