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.
MusicServiceConnection
is the class responsible for connecting ui and service.- In
MusicServiceConnection
we 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 toMediaBrowserCompat
will be called .i.e.MediaBrowserCompatConnectionCallback()
. MediaControllerCompat
is invoked inMediaBrowserCompatConnectionCallback.onConnected()
.MediaControllerCompat
Allows 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.MediaControllerCallback
we listen to app interactions such as onPlaybackStateChanged, onMetadataChanged, etc. And update our ui accordingly.
Architecture: