Video playing automatically in UIWebView

前端 未结 1 430
Happy的楠姐
Happy的楠姐 2021-01-13 15:45

Hi I have a webview and when i tried to load the video files in that , it starts playing the video automatically without user intervention. And also the play button is still

1条回答
  •  一个人的身影
    2021-01-13 16:02

    - (void)videoThumb:(NSString *)urlString frame:(CGRect)frame {
              NSString *embedHTML = @"\
              \
              \
              \
              \
              ";
    
    
      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.

    0 讨论(0)
提交回复
热议问题