WebView에서 비디오 파일을 재생할 수 있지만 비디오는 사용자 개입없이 자동으로 재생됩니다. 그래서 지금은 그것을 달성하기 위해 다른 접근 방식을 따르고 있습니다.UIWebView에서 재생하려면 로컬 비디오 파일을 Html로 포함하는 방법은 무엇입니까?
NSString* embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"http://www.businessfactors.de/bfcms/images/stories/videos/defaultscreenvideos.mp4\" type=\"application/x-shockwave-mp4\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
_webView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 412.0)];
[_webView setOpaque:NO];
NSString *html = [NSString stringWithFormat:embedHTML, _webView.frame.size.width, _webView.frame.size.height];
[_webView loadHTMLString:html baseURL:nil];
이렇게하면 인터넷에서 비디오 파일을 재생할 수 있습니다. 하지만 로컬 메모리에서 파일을 재생하고 싶습니다.
로컬 파일 경로 변수를 전달하려고 시도하더라도 비디오를 재생할 수 없습니다. 누구든지 내 로컬 파일을 html에 삽입하여 인터넷 비디오처럼 webview에서 재생할 수있는 방법을 말해 줄 수 있습니까?
사례 1 : 비디오가 자동으로 WebView에서 재생되지만 재생 버튼은 여전히 상단에 있습니다. 사례 2 : 온라인 동영상 URL이 위와 같이 삽입되어 동영상을 재생할 수 있습니다. 하지만 온라인 비디오 URL 대신 로컬 비디오 파일 경로를 전달하고 싶습니다.
여기 내 [대답] [1]을보십시오. 희망이 있습니다. [1] : HTTP : //stackoverflow.com/questions/6759818/embed-video-in-html-file-loaded-in-uiwebview-from-documents-folder-of-applicatio/6964742#6964742 –