首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >添加Youtube视频剪辑

添加Youtube视频剪辑
EN

Stack Overflow用户
提问于 2012-01-14 01:37:59
回答 1查看 91关注 0票数 0

这很好用,但它首先会显示一个缩略图视图,在这个视图中我必须单击它才能播放视频。所以我需要删除这个缩略图视图,并直接播放视频。我该怎么做呢。我的代码如下;

代码语言:javascript
复制
- (YouTubeView *)initWithStringAsURL:(NSString *)urlString frame:(CGRect)frame;
    {
  if (self = [super init]) 
  {
    // Create webview with requested frame size
    self = [[UIWebView alloc] initWithFrame:frame];

    // HTML to embed YouTube video
    NSString *youTubeVideoHTML = @"<html><head> <meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 480\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"> <div><object width=\"480\" height=\"256\"> <param name=\"movie\" value=\"http://www.youtube.com/v/oHg5SJYRHA0&f=gdata_videos&c=ytapi-my-clientID&d=nGF83uyVrg8eD4rfEkk22mDOl3qUImVMV6ramM\"></param><param name=\"wmode\" value=\"transparent\"></param> <embed src=\"http://www.youtube.com/v/oHg5SJYRHA0&f=gdata_videos&c=ytapi-my-clientID&d=nGF83uyVrg8eD4rfEkk22mDOl3qUImVMV6ramM\"type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"480\" height=\"256\"></embed> </object></div></body></html>";

    // Populate HTML with the URL and requested frame size
    NSString *html = [NSString stringWithFormat:youTubeVideoHTML, urlString, frame.size.width, frame.size.height];

    // Load the html into the webview
    [self loadHTMLString:html baseURL:nil];


}
  return self;  
}
EN

回答 1

Stack Overflow用户

发布于 2012-01-14 01:44:04

使用autoplay参数。所有参数都在here中描述。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8854791

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档