How to build a Music Player properly?

Discussion in 'iOS Programming' started by ZestyOne, Jan 19, 2016.

  1. ZestyOne macrumors member


    Oct 18, 2009
    I'm building an audio player on both mobile platforms: iOS + Android. For right now I'm just interested in iOS.

    These are the features I will have. If it makes it simpler to think about, it will be exactly like how Spotify functions (see screenshots below).

    Here are the features anyway:

    • Working play queue/playlist
    • Play / pause
    • Shuffle / repeat
    • Skip / previous
    • Scrubbing via dragging in the UI
    • Auto buffering next song (maybe?)
    • Different quality options
    • Play music when app is closed, including navigating to next/previous song on playlist

    I'm not a native developer though, and I'm trying to just research to find information on what to tell my developers on the course of action they should choose, and I'm having a lot of difficulty grasping these concepts.

    Fast sidenote: my app deals with actual 'tracks', it doesn't deal with continuous streaming type stuff like a continuous news channel stream or anything.

    Here are the questions I have...

    1. What are the pros and cons of using an `m3u/m3u8` playlist, vs streaming an mp3 file? Is one of these obviously better than the other, given the features I need above? I'm having difficulty whether to choose streaming mp3's, m3u, or m3u8.
    2. It's my understanding that HLS automatically chooses the right bitrate. I see many audio players however let the user choose which quality to use in the settings pane (high/med/low). Does this imply these apps are not using HLS? Which of the above 3 options do you think the majority of apps use?
    3. I wanted to offer 3 qualities similar to Spotify (96, 160, 320 kbps). Are there limitations of doing this while streaming mp3's?
    4. Assuming that streaming mp3's is still an option (and not immediately eliminated as a contender), are there performance differences with streaming mp3's vs using a playlist? Can you still do thinks like scrubbing and skipping tracks with no more delay?
    5. Are there any popular libraries for both platforms that handle all of this stuff? My entire app is a music player so I'm looking for something that is well maintained and trusted. I dont even know if I need a wrapper to be honest though as my use case is quite simple.
    6. I would assume I need to do some transcoding... are there any downsides to just using `ffmpeg` on the server and doing it myself?

    Overall any insight would be helpful... I feel as I'm drowning in information, and while I'm usually pretty good about finding my way, this is one case where I'm just so lost as to how to proceed.


    Here are a few screenshots of the Spotify player to give you a feel of what I'm looking to do. Mine looks a lot different, but 100% the same functionality.

    Play screen


    Lock screen

  2. Dookieman macrumors 6502

    Oct 12, 2009
    I'm currently writing a Podcast player which is essentially an Audio/Music playing app. I've already developed all of your features, so I'll try and answer your questions as best I can.

    I am using Apple's AVPlayer framework. It's great!

    1. A .m3u simply tells the player the MP3 order and provides links. You can stream a MP3 or play it locally from the device.

    2. I'm not sure what HLS.

    3. There are no limitation on streaming different bit rates to an app. This is most likely decided by the back end server on it's settings, or the app can potentially have an option on the users preferred bit rate.

    4. Using streaming with AVPlayer, there are minimal performance differences. You can scrub and skip tracks as you like. There is a short delay (1 - 3 seconds) based on the users connection speed that the app needs to gather MP3 header information and begin playing.

    5. I'm using a native approach. There may be 3rd party tools out there, but I doubt they integrate well with the iOS platform. Using Apple's framework you get all the bells and whistles at your finger tips.

    6. No, iPhone's can decode the audio themselves.
  3. moonman239 macrumors 68000

    Mar 27, 2009

Share This Page