在UIWebView中自动播放video

您好我有一个网页视图,当我试图加载video文件,它开始播放video自动无需用户干预。 而且播放button仍然在webview中显示(video正在播放)。 我正在使用下面的代码来加载URL

NSURL* url = [NSURL fileURLWithPath:filePath]; NSURLRequest* request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request]; 

你能告诉我如何禁用播放button或者video应该只有在用户点击播放button后才能开始播放?

 - (void)videoThumb:(NSString *)urlString frame:(CGRect)frame { NSString *embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent; color: white; }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\"></embed>\ </body></html>"; NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width,frame.size.height]; [webView loadHTMLString:html baseURL:nil]; [self.view addSubview:webView]; [webView release]; } //Include above function to your page and call it by passing the urlstring [self videoThumb:url:frame]; //frame : this parameter needs the size of the thumb you want to use. 

我希望这可以帮助你和更好的方式为你的目的。