Hi, I want to play an audio stream as soon as my appliction loads. But what I need to know is how to acutally play the stream. I think it requires the AudioToolbox.framework and CoreAudio and AudioFileStreamOpen but I don't know how. All I need it to do is start playing when the app opens and stop when it closes, buffer would be nice but isnt needed right now. I'm a bit of a noob so be nice and explain in detail please.
Hi, I want to play an audio stream as soon as my appliction loads. But what I need to know is how to acutally play the stream. I think it requires the AudioToolbox.framework and CoreAudio and AudioFileStreamOpen but I don't know how. All I need it to do is start playing when the app opens and stop when it closes, buffer would be nice but isnt needed right now. I'm a bit of a noob so be nice and explain in detail please.
To play streamed audio, you connect to a network stream using the CFNetwork interfaces from Core Foundation, such as those in CFHTTPMessage. You then parse the network packets into audio packets using Audio File Stream Services (AudioToolbox/AudioFileStream.h). Finally, you play the audio packets using Audio Queue Services (AudioToolbox/AudioQueue.h). You can also use Audio File Stream Services to parse audio packets from an on-disk file.
To Play the audio when the app opens just use - (void)awakeFromNib {
That is quite helpful and my be enough. I was looking for a code example but I will try to research this more (UGH ive been doing research for 5+ hours straight, honest) but this is a lot more stuff than people have give me to put together before, thanks!
warning: passing argument 1 of 'CFReadStreamOpen' from incompatible pointer type
warning: passing argument 1 of 'CFReadStreamRead' makes pointer from integer without a cast
warning: passing argument 2 of 'CFReadStreamRead' makes pinter from integer without a cast
warning: passing argument 4 of 'AudioFileStreamOpen' makes integer from pointer without a cast
warning: passing argument 5 of 'AudioFileStreamOpen' makes pointer from integer without a cast
warning: passing argument 1 of 'CFReadStreamOpen' from incompatible pointer type
warning: passing argument 1 of 'CFReadStreamRead' makes pointer from integer without a cast
warning: passing argument 2 of 'CFReadStreamRead' makes pinter from integer without a cast
warning: passing argument 4 of 'AudioFileStreamOpen' makes integer from pointer without a cast
warning: passing argument 5 of 'AudioFileStreamOpen' makes pointer from integer without a cast
so i think i messed up some of these arguments.
I think it may be due to the / after the URL. Not entirely sure though, give it a go without the /.
I have searched for my days on how to keep streaming when the screen locks with AudioToolBox
Any ideas
Allen
I just added the key "UIBackgroundModes" with value "audio" to the info.plist and the example from iphonemobdev now continues in background or screen locked.