ios webview 只能播放带域名的视频连接好奇怪!

- (void)loadWebView
{
    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,
                                                                     0,
                                                                     SCREEN_WIDTH,
                                                                     SCREEN_HEIGHT)];
    [webView setDelegate:self];
    webView.allowsInlineMediaPlayback = YES;
    webView.mediaPlaybackRequiresUserAction = NO;
//    _urlLink = @"https://docs.google.com/uc?export=download&id=0B6wwyazyzml-TVNHYThCemt2SDg";
    NSString *strVideoAddress = [NSString stringWithFormat:
                                 @"<html><body><video id=\"frag1\" controls preload=\"metadata\">\
                                 <source src=\"%@\"  type='video/mp4;codecs=\"avc1.42E01E, mp4a.40.2,vp8, vorbis,utf-8\"' data-original=\"%@\">\
                                 </video></body></html>",_urlLink,_urlLink];
    
    //TODO:why?换我们的连接 web 不能播放 http://218.17.162.199:6001/api/attachment/download/73
    //TEST video url https://docs.google.com/uc?export=download&id=0B6wwyazyzml-TVNHYThCemt2SDg


    [self.view addSubview:webView];
    [webView loadHTMLString:strVideoAddress baseURL:nil];

}//

 

posted on 2016-12-13 10:02  助金  阅读(286)  评论(0编辑  收藏  举报