Stream Audio from URL

Hi All. Writing a swift iOS app (target iOS 13.1) and wanted to know if AVAudioPlayer or something else would fit these requirements:


- Stream from URL (with auto-reconnect if network hiccups)

- Stop and Start button (obviously)

- Ability to choose the stop/start button images

- Volume slider

- Ability to use the switch object to switch between two audio streams (two different URLs)

- Audio plays when app is in background

- Display title/track metadata

- And would really like an audio level meter


I pieced together all these (with help of freelancers) when the app was in Obj-C. Now rebuilding in Swift.


P.S. I'm an advanced newbie (a notch above newbie) so go easy on me :-)


Thank-you!

Replies

- Stream from URL (with auto-reconnect if network hiccups)

You should better check the documentation.


> An audio player that provides playback of audio data from a file or memory.

If you mean URL as network resources, AVAudioPlayer does not support such external audio data.


- Stop and Start button (obviously)

:

- And would really like an audio level meter

AVAudioPlayer does not provide any of UIs. And there are not any features in Apple's platform that supports all the features.

You may need to implement all such UIs, and that is writing an app.

All that you wrote can be done of course ... but you propably need more than AVAudioPlayer for this. Like OOPer said, AVAudioPlayer doesn't provide you with a UI... just functionality (https://developer.apple.com/documentation/avfoundation/avaudioplayer).