Heena
Heena

Reputation: 2358

iphone: how to buffer and play audio?

I need to implement the code for my app to buffer and play my audio file which is I am streaming.

I got one of the option AudioQueue but didn't find much code to understand the things to implement.

I have tried with Simply creating streamer and destroying streamer.

-(void)destroyStreamer
{
    if(streamer)
        [streamer stop];
}

-(void)createStreamer
{
    if(streamer)
        return;
    [self destroyStreamer];

    NSString *escapedValue = (__bridge_transfer NSString * )CFURLCreateStringByAddingPercentEscapes(nil, (__bridge CFStringRef)txtField.text, NULL, NULL, kCFStringEncodingUTF8);

    NSURL *url = [NSURL URLWithString:escapedValue];

    streamer = [[AudioStreamer alloc] initWithURL:url];


}

Upvotes: 0

Views: 1142

Answers (1)

EladG
EladG

Reputation: 804

You may need to use the AudioToolBox framework.

There are multiple ways of playing sounds (long/short/format support etc...). checkout this presentation which covers it from start to end.

Upvotes: 1

Related Questions