I am trying to load a Video in UIWebView. Video is stored in local file system. Here is the code snippet I am using for loading the video.
{
NSString* filePAth = [[NSBundle mainBundle] pathForResource:@"sample_iPod" ofType:@"m4v"];
NSLog(@"%@",filePAth);
NSData* data = [NSData dataWithContentsOfFile:filePAth];
[_webView loadData:data MIMEType:@"video/x-m4v" textEncodingName:@"UTF-8" baseURL:nil];
}
This is the error I get in console:
Error in Webview loading: Error Domain=WebKitErrorDomain Code=204
“Plug-in handled load” UserInfo=0x1f8b3c70
{NSErrorFailingURLStringKey=applewebdata://3F0047AD-E6CF-4EAD-A4C3-DA6E1C0BD603,
WebKitErrorMIMETypeKey=video/x-m4v,
NSErrorFailingURLKey=applewebdata://3F0047AD-E6CF-4EAD-A4C3-DA6E1C0BD603,
NSLocalizedDescription=Plug-in handled load}
However, The same code works for loading all other file type for eg: PNG, DOC et.c.
Please help…!!!
You should load local videos and other videos whenever possible with
MPMoviePlayerController– (Documentation) – If playing the video is all you need and want and you are developing a native app.