开发者

Best Method For Playing M4A file in iPhone App

Greetings,

I have a tableview where I have parsed an li开发者_运维问答st 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜