I have been searching for days but I am still not able to understand how exactly these differ in functionality and what role does each of them play in Media Playback? It would be very helpful if someone can explain the difference.
how exactly these differ in functionality
That is akin to asking how a shovel, a hammer, and a piece of rope differ in functionality. While all can be considered tools, they are not really replacements for one another in most use cases.
what role does each of them play in Media Playback?
MediaPlayer
plays media on the Android device (audio and video, from local or streaming sources).
RemotePlaybackClient
directs some other piece of hardware to play media. The classic example of this is using RemotePlaybackClient
to tell a Chromecast to play a video.
While I have not dealt with MediaSession
(or MediaSessionCompat
), it appears to tie your media playback logic with media controllers that live outside your app, such as a Notification.MediaStyle
notification (to control media playback from the Android 5.0+ lockscreen), Android Auto, etc.