0

What is the best way to play/stream a mp3 file without having to download the entire mp3 upfront - just buffer maybe 10 seconds and then start playing?

And is there a way to also cache the mp3 file on disk, when it has finished downloading, or as it buffers preferably?

AVAudioPlayer doesn't seem to be allowed for http streaming, could MPMoviePlayer be used instead - it has a confusing name if it is good for audio only too?

user2210889
  • 123
  • 2
  • 8
  • see smiler question http://stackoverflow.com/questions/13131177/streaming-mp3-audio-with-avplayer – Tirth Apr 09 '13 at 16:48
  • Yeah, i've seen that, but it seems rather dated, lot's of references to iOS 4 code, but maybe nothing has happened since then? – user2210889 Apr 09 '13 at 20:17
  • I suggest follow those references. Because the AVFoundation framework classes and it feature not change since yet. – Tirth Apr 09 '13 at 22:47

2 Answers2

0

The best way to stream mp3 over http is by using AVPlayer. This link consist a very handy explanation on how to stream mp3

Community
  • 1
  • 1
Muhammad Irfan
  • 280
  • 3
  • 17
0

You can use AVPlayer for streaming audio or video. AVPlayer can handle online streaming which AVAudioPlayer not handeling. For use AVPlayer try this demo.

SDS
  • 211
  • 1
  • 7