tags:

views:

39

answers:

1

Greetings,

I have a tableview where I have parsed an list of podcasts(m4a format). I want to now play the podcasts. I have seen Matt Gallaghers method but it seems a bit excessive for what I need. I remember seeing a tutorial where you could play such a file in UIWebview but it doesn't seems to work. Any suggestions would be greatly appreciated. Thank you in advance.

+1  A: 
NSString * basePath = [NSHomeDirectory() 
           stringByAppendingPathComponent:@"Documents"];

basePath=[basePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
basePath=[basePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];    

NSURL * baseURL = [NSURL URLWithString: [NSString      
                             stringWithFormat:@"file:/%@//",basePath]]; 

NSString *html = @"<html><body><audio src=\"test.mp3\" 
                                      controls></audio></body></html>";
[self.view loadHTMLString:html baseURL:baseURL];

I rewrote the code and got this to work, the catch was handling the blanks in the document base path that was causing issue for me.

Aaron Saunders
Aaron, thanks for your help but it is still not working. What is playerWebView?
Daniel
@Daniel try the new stuff...
Aaron Saunders