Video playing automatically in UIWebView

限于喜欢 提交于 2019-12-01 06:16:45
- (void)videoThumb:(NSString *)urlString frame:(CGRect)frame {
          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>";


  NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width,frame.size.height];

  [webView loadHTMLString:html baseURL:nil];
  [self.view addSubview:webView];
  [webView release];
}

//Include above function to your page and call it by passing the urlstring
[self videoThumb:url:frame];


//frame : this parameter needs the size of the thumb you want to use.

I hope this may help you and better way for your purpose.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!