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.
Related
I have an HLS live stream (from an external source, not one I created or can edit) with video and several audio options. I can successfully change the audio to one of the alternatives, but the alternative audio the stream provides doesn't match up perfectly with with video (it's about 1.5 seconds ahead of the video).
Is there a way to have the AVPlayer delay the audio portion of the stream by some specified amount to correct for this? Or is that not possible?
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.
I am working on radio app in which i want to record live radio streaming on an record button click.It should record just the radio streaming sound. Currently i am recording from Mike but its not the way i want as it also captures the surrounding/background voice. I did read few post but all of them are regarding AVaudioRecorder. I have used wunderradio api for playing the radio from url. I haven't got any method/function in their api which will record that audio from url. I want to record the buffered audio only from that url,so that I can play that recorded file later.
Any help would be appreciated.
Recording audio playback by using the microphone is really not the right way to do it. If you're using AudioQueue services for audio playback you can use the AudioFileWritePackets function to write audio data to a file.
If you implement recording this way you can write audio files in the format they're streamed in. So an mp3 audio stream can be written as an mp3 file to disk since you're writing encoded audio packets with the AudioFileWritePackets function.
To get a better understanding of how this all should be implemented you can have a look at the SpeakHere sample code of Apple. The SpeakHere project records from the microphone but it's still a good example to see how the AudioFileWritePackets function works. In your case you need to use the AudioFileWritePackets function in the output callback of your AudioQueue. This is the callback that's called when a buffer is finished playing. So it's a good to place to write the already played audio buffers data to a file.
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
I've some trouble with audio streaming using MPMoviePlayerController.
I want to know if it's possible to save the data streaming info to a file while MPMoviePlayer is playing that file.
Is there a simple way to do this?
Does anyone have an idea?
According to apple (http://developer.apple.com/library/ios/#codinghowtos/AudioAndVideo/_index.html) for streaming audio you connect to a network stream using CFNetwork interfaces from CoreFoundation, then parse the network packets into audio packets using Audio File Stream Service (AudioToolbox/AudioFileStream.h) and then play the audio packets using Audio Queue Services (AudioToolbox/AudioQueue.h) ….
Now my idea is that if we can find some way to write the audio packets to the file in between sending the packets to the audio queue then we can save the audio stream while playing them…
Its just an idea that needs implementation and don't know weather it will work for video stream or not.