Very short snippet: streaming mp3 file su Apple iPhone
martedì 1 dicembre, 2009Un'alternativa davvero semplice per eseguire uno streaming di un file mp3 su Apple iPhone potrebbe essere: PLAIN TEXT Objective-C: // Utilizzare AVFoundation Framework e nell'header file (.h) aggiungere // #import <AVFoundation/AVFoundation.h> // Nell'implementazione // inserite l'url del file mp3 NSString * soundFilePath = @"http://www.server.com/test.mp3"; NSURL * fileURL = [NSURL URLWithString:soundFilePath]; NSURLRequest * request = [NSURLRequest requestWithURL:fileURL]; NSData *dataRaw = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; AVAudioPlayer [...]










