开发者

Quicktime appear when play mp3 file in webview

开发者 https://www.devze.com 2023-03-24 01:06 出处:网络
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

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

精彩评论

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

关注公众号