Play Mp3 from after saving it locally on iPhone
<p>Hi friends I got a question. Here it is:</p>

<p>I want to play an mp3 song which first will be downloaded locally and then it will be played.</p>

<p>I have written following code. Please have a look:-</p>

<pre><code>NSURL *url = [NSURL URLWithString:[songURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];    
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0];
[request setHTTPMethod:@"POST"];
NSURLResponse *response;        
NSError *error;
NSData* result = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
NSString *pathForSoundFile  = [[paths objectAtIndex:0] stringByAppendingString:[NSString stringWithFormat:@"/my.mp3"]];
NSLog(@"%@",pathForSoundFile);

NSURL *myURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@",pathForSoundFile]];

[self  playPreviewMethod];

-(void)playPreviewMethod
{
    [songPreview play];
}
</code></pre>

<p>What i guess is that the file is not downloaded or converted in the mp3 format. Please help!</p>
