首页 > 解决方案 > 使用 Hyperloop 在 iOS Appcelerator 中播放 Youtube 视频

问题描述

我正在使用 appcelerator 为 iOS 制作应用程序,我陷入了这种情况,就像以前我使用 webview 播放 youtube 视频但现在有些视频没有播放一样。

我在 webview 中尝试了很多但没有成功。所以我用目标 C 编码,它在本地工作。然后我尝试为它制作模块,所以没有成功。

任何人都可以帮助我制作模块或使用超级循环使其工作。以下是我的目标代码,它正在工作: -

UIWebView *videoView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 180)];
videoView.backgroundColor = [UIColor clearColor];
videoView.opaque = NO;
videoView.delegate = self;
NSString *videoUrl = @"http://www.youtube.com/v/1MjC30zo1KA";
NSString *htmlString = [NSString stringWithFormat:@"\
                        <html>\
                        <head>\
                        <meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 212\"/>\
                        </head>\
                        <body style=\"background:#FFF;margin-top:0px;margin-left:0px\"><div><object width=\"320\" height=\"180\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"320\" height=\"180\"></embed></object></div></body></html>",videoUrl,videoUrl];
[videoView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];

这段代码像魅力一样工作,但在使模块应用程序崩溃后,以下行: -

UIWebView *videoView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 180)];

在这种情况下帮助我,在此先感谢。

标签: iosyoutubetitaniumappceleratorappcelerator-hyperloop

解决方案


推荐阅读