As my previous post about creating Android Music Player was getting a lot of traction, I figured it’s about time to do a rewrite as the previous one is ages old and there have been a lot of improvements and better APIs on Android for supporting music since then. This is going to be the first of a series of post talking about building a full fledged music player app with streaming, custom playlists, offline tracks (basically a boiled down Spotify clone).
Here’s a list of all tutorials in this series:
- Media Player basics An introduction to the Android multimedia framework that includes support for playing variety of common media types, so that you can easily integrate audio, video and images into your applications. You can play audio or video from media files stored in your application’s resources (raw resources), from standalone files in the filesystem, or from a data stream arriving over a network connection, all using MediaPlayer APIs.
- Playing music in the background If you want your media to play in the background while the user is interacting with other applications, then you must start a Service and control the MediaPlayer instance from there. If you have never worked with Services before, it might be worthwhile to read a quick overview from the guide.
- Music Player Controls on Lock Screen and Notifications
This post will discuss how to show Media Player controls on the lock screen and the notifications using a
MediaSession
. - Creating Music Player UI: Discusses how to create a UI for the music player with a full screen blurred background for album artwork, the track artwork, title, and the playback controls.
- Creating a toolbar to embed on all activities: Learn how to create a toolbar that displays current music player status and allows quick options to play, pause or stop music. Learn how to embed this toolbar on all activities and provide a slide to stop behaviour.
- Handling music playlists (local)
If you are looking to get a custom music player app built for you, feel free to reach out to me at this email.
I have had far too many requests for the source code and the reason I am not putting it up is that as all source code, it requires constant maintenance and I don’t have enough time to manage this. Secondly, I have seen far too many people picking up the source code and putting it as is into the app which floods the already sub-par app market with low-quality apps aimed only for ad revenue. There is already a good, well-maintained music player source code maintained by Google if someone really needs it. Otherwise, if you need professional help, please feel free to shoot me an email.
Please don’t post comments asking for the source code. It’s not that hard to put everything up together. Give it a try and ask for help if you run into issues.