detailVideo.h
@interface detailVideo : UIViewController {
IBOutlet UIWebView *webview;
NSString *urlAddress;
}
@property(nonatomic,retain)NSString *urlAddress;
@end
detailVideo.m
- (void)viewDidLoad {
NSString *reqUrl = urlAddress;
//Create a URL object.
NSURL *url = [NSURL URLWithString:reqUrl];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webview loadRequest:requestObj];
// webView.opaque = NO;
webview.delegate = self;
}
视频工作正常。但是如果我单击完成按钮,它会重新显示包含重播按钮的其他页面。我想从此视图切换回来吗?
我该怎么做?
答案 0 :(得分:0)
您可以在嵌入式UIWebView中播放视频,请尝试使用此代码。
- (void)viewDidLoad {
[super viewDidLoad];
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"http://www.businessfactors.de/bfcms/images/stories/videos/defaultscreenvideos.mp4\" type=\"application/x-shockwave-mp4\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 412.0)];
[webView setOpaque:NO];
NSString *html = [NSString stringWithFormat:embedHTML, webView.frame.size.width, webView.frame.size.height];
[webView loadHTMLString:html baseURL:nil];
[self.view addSubview:webView];
}