Best way to play/stream an mp3 over http on iOS? - iphone

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?

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

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

Related

Which audio playback options exist for playing MP3 or AAC files on iOS?

I figured out AVAudioPlayer can play MP3 or AAC. But it also has a big latency. It seems to be loading the entire file into memory first.
Are there other, more efficient options than AVAudioPlayer?
Yes, there are AVPlayer and MPMoviePlayerController (which, despite its name, can also play audio files). MPMoviePlayerController tends to be a bit easier to use in my opinion.
You can use OpenAL library for that which is very very efficient for the purpose you are talking about
Here is the link
https://github.com/kstenerud/ObjectAL-for-iPhone
Have a look .Its too easy to integrate and implement.
Cheers!!!
The lowest-level and lowest-latency option that you can get on iOS is RemoteIO.
This question has some more relevant information: Playback MP3 using RemoteIO and AudioUnits on iPhone... possible?

Play mp3 audio over http socket on iphone

I am trying to write an iPhone app that playback mp3 audio streamed by our audio server over http socket. I am just wondering if there is any easy solutions that play the mp3 directly over the socket without any local buffering and conversion?
I found same posts about streaming mp3 files over HTTP connection but with no luck to find anything useful about the socket streaming.
Thank you in advance.
The most trivial solution would be the use of MPMoviePlayerController for the playback of streaming audio via HTTP.
Introduction
Alternatives
May be what you could do is impliment a mini server on the iPhone here is a one then simply stream the mp3 from there

IPhone Video Streaming Problem

I want to implement video streaming in my project. So, Is there any tutorial that works? Videos are stored at server side. So, to fetch video using url and play it on MPMoviePlayerViewController .
Thank You.
For video streaming in iPhone you can use ffmpeg concept.FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.Have a look at these sites for samples,
https://github.com/FFmpeg/FFmpeg
http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/
Check this solution, it's a full audio and video streamer.

How to play streaming audio file in iphone?

How to play streaming audio file in iphone?
I am trying to make an app which can play audio file from web server with Play Pause and stop functionality....
can any one have any idea about this ?
This is a lot simpler now with the advent of AVFoundation. Look at the AVPlayer class. It works great for streaming audio.
Check Matt Gallagher work:
http://cocoawithlove.com/2008/09/streaming-and-playing-live-mp3-stream.html
If this is more that you're willing to, the easy answer would be HTTP Live Streaming.

Streaming audio from iPhone

Does anybody know of a way to stream audio from a file being played back in an app over the internet in a standardized streaming audio format? That is server up an Audio stream from the iPhone.
You need a http server on you device, multiple packet audio files, like:
http://your.com/audio1.mp3
http://your.com/audio2.mp3
http://your.com/audio3.mp3
And m3u file that shows the current realtime file... surely with a small delay, try 0.5 sec, the client opens http://your.com/play.m3u and plays with AVPlayer the stream. Like that.
In 4.0, just open the .m3u URL with the AVAudioPlayer. It was never simpler to stream audio.