Hi All,
I am trying to play audio files streamed from the internet. I am having a strange problem, whenever I try to play the file from the iphone simulator, it is not played but after I copy and paste the url of the file in safari and play it there, it begins to play well in the simulator.
I am using
NSData *data;
NSURL *url = [NSURL URLWithString: @"http://files.samhart.net/audio/simpsons/The_Simpsons_-_Willy_-_Space_Invaders.mp3"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: url
cachePolicy: NSURLRequestReloadIgnoringCacheData
timeoutInterval: 1];
NSURLResponse *response;
NSError *error;
data = [NSURLConnection sendSynchronousRequest: request returningResponse: &response error: &error];
player = [[AVAudioPlayer alloc ]initWithData:data error:nil];
[player play];
NSLog(@"duration %f", player.duration);
What is the reason?
Anybody plzz...help...