我无法播放这种格式的视频。
http://www.youtube.com/embed/lNOMZoF9VlM?rel=0
我的 html 字符串。
NSString *html = [NSString stringWithFormat:@"<html><head>\
<body style=\"margin:0\">\
<embed id=\"yt\" src=%@ type=\"application/x-shockwave-flash\" \
width=\"120\" height=\"120\"></embed>\
</body></html>",str];
请回复。
最佳答案
试试这个,它对我有用......
CGRect frame = CGRectMake(40, 55, width, height);
NSString *embedHTML =[NSString stringWithFormat:@"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: blue;\
}\
</style>\
</head><body style=\"margin:0\">\
<iframe height=\"220\" width=\"400\" src=\"http://www.youtube.com/embed/lNOMZoF9VlM\"></iframe>\
</body></html>"];
webview = [[UIWebView alloc] initWithFrame:frame];
webview.backgroundColor = [UIColor clearColor];
webview.scrollView.scrollEnabled =NO;
[webview loadHTMLString:embedHTML baseURL:nil];
[self.view addSubview:webview];
关于iPhone 在网页 View 中播放 YouTube 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12209994/