问题描述
我正在尝试从UIWebView启动嵌入式Youtube视频,但是从手机中选择它们时在控制台中出现此错误:
I'm trying to launch embedded Youtube videos from a UIWebView, but get this error in the console when selecting them from the phone:
警告:无法读取"/Developer/Platforms/iPhoneOS.platform/DeviceSupport/2.2/Symbols/System/Library/Internet插件/YouTubePlugIn.webplugin/YouTubePlugIn"的符号(找不到文件).
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/2.2/Symbols/System/Library/Internet Plug-Ins/YouTubePlugIn.webplugin/YouTubePlugIn" (file not found).
URL很好,因为我可以从Safari播放它.
The URL is good, since I can play it from Safari just fine.
有人有问题吗?
老兄,这个论坛的反应速度总是让我印象深刻.
Man, I'm always impressed at how responsive this forum is.
无论如何,这是我在网上找到并调整的嵌入代码:
Anyway, here is the embed code that I found on the web and tweaked:
- (void)embedYouTube {
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>";
CGRect frame;
frame.size.width=100; frame.size.height=80;
frame.origin.x=10; frame.origin.y=10;
NSString *url=@"http://www.youtube.com/watch?v=g8thp78oXsg";
NSString* html = [NSString stringWithFormat:embedHTML,url, 100, 80];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:[NSURL URLWithString:nil]];
[self.view addSubview:videoView];
[videoView release];
NSLog(@" in embed %@",html);
}
我将示例URL放在上面的"URL"中,以显示我正在使用的URL(为什么有很多URL).
I put the sample URL in, uhh, 'url' above to show which URL I'm using (whew, lots of urls).
所以我什至去了这个网址:
So I even went to this URL:
http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
并将其示例代码复制到此处:
and copied their example code here:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.youtube.com/v/oHg5SJYRHA0&f=gdata_videos&c=ytapi-my-clientID&d=nGF83uyVrg8eD4rfEkk22mDOl3qUImVMV6ramM"]];
摘自2009年2月5日的那篇文章,它启动了Youtube播放器,但我收到"Youtube不可用".
from that article written on 2/5/09, and it launches the Youtube player, but I get "Youtube not available."
我尝试了YouTube帖子,但没有回应.任何人都知道如何使这个简单的功能正常工作吗?还是这与我的iPhone有关?
I tried the Youtube postings, but no response. Anyone have any idea how to get even this simple function to work? Or is this something to do with my iPhone maybe?
老兄,这个论坛的反应速度总是让我印象深刻.
Man, I'm always impressed at how responsive this forum is.
无论如何,这是我在网上找到并调整的嵌入代码:
Anyway, here is the embed code that I found on the web and tweaked:
- (void)embedYouTube {
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>";
CGRect frame;
frame.size.width=100; frame.size.height=80;
frame.origin.x=10; frame.origin.y=10;
NSString *url=@"http://www.youtube.com/watch?v=g8thp78oXsg";
NSString* html = [NSString stringWithFormat:embedHTML,url, 100, 80];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:[NSURL URLWithString:nil]];
[self.view addSubview:videoView];
[videoView release];
NSLog(@" in embed %@",html);
}
我将示例URL放在上面的"URL"中,以显示我正在使用的URL(为什么有很多URL).
I put the sample URL in, uhh, 'url' above to show which URL I'm using (whew, lots of urls).
所以我什至去了这个网址:
So I even went to this URL:
http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
并将其示例代码复制到此处:
and copied their example code here:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.youtube.com/v/oHg5SJYRHA0&f=gdata_videos&c=ytapi-my-clientID&d=nGF83uyVrg8eD4rfEkk22mDOl3qUImVMV6ramM"]];
摘自2009年2月5日的那篇文章,它启动了Youtube播放器,但我收到"Youtube不可用".
from that article written on 2/5/09, and it launches the Youtube player, but I get "Youtube not available."
我尝试了YouTube帖子,但没有回应.任何人都知道如何使这个简单的功能正常工作吗?还是这与我的iPhone有关?
I tried the Youtube postings, but no response. Anyone have any idea how to get even this simple function to work? Or is this something to do with my iPhone maybe?
推荐答案
这已经有一段时间了,但是我还添加了多余的字符,并且我的嵌入代码也被更改了.
This was awhile ago, but I also was adding extraneous characters and my embed code was changed.
另外,请注意,某些视频不可用,尚未转换为h.264等.
Also, to note some videos are just either not available, haven't been converted to h.264 yet, etc.
我仍然收到错误消息(即):
I still get the error (i.e.):
警告:无法读取"/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2.1(7B405)/Symbols/System/Library/Internet Plug-Ins/YouTubePlugIn.webplugin/YouTubePlugIn"的符号(找不到文件).
warning: Unable to read symbols for "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2.1 (7B405)/Symbols/System/Library/Internet Plug-Ins/YouTubePlugIn.webplugin/YouTubePlugIn" (file not found).
但是视频仍然可以播放.因此,我认为找不到符号库控制台消息的事实是在插件启动之前抛出的红鲱鱼".
But videos still play if they can be played. So I think the fact that the symbol library cannot be found console message is a "red herring" thrown before the plugin launches.
这篇关于加载YouTube视频时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!