开发者

Quicktime appear when play mp3 file in webview

when i use a webview to play an mp3 file, the quick time player appears. However, i notice that this does not necessarily happen to other devices i.e., for other iphones, the mp3 file continue playing but the quick time player does not appear. As a re开发者_如何学JAVAsult, user is unable to fast forward/pause etc. the mp3 file.

Is there any way that i can strictly enforce that the quicktime player appears?

Here is my code NSURL *myUrl = [NSURL URLWithString: self.url];

NSURLRequest *request = [[NSURLRequest alloc] initWithURL:myUrl  cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval: 10];

NSLog(@"Play URL: %@", self.url);
UIWebView *webView2 = [[UIWebView alloc] init];
[webView2 loadRequest: request];

[request release];


The fact the quick time player didn't appear may well be a bug. It's a know bug in one of the iOS 5.0 beta releases. Normally WebKit will detect the content type from the HTTP header or file extension and open the AVPlayer from there. You could try using an NSMutableURLRequest and setting the content type header.

[[myRequest headers] setObject:@"video/mp4" forKey:@"Content-Type"]

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜