Я могу онлайн-видео по указанному ниже коду, но не могу оффлайн-видео (SD-карта / внутреннее хранилище) в веб-просмотре.
String text = "<h4>Write the type of reaction in the following</h4><h4> 1) Reaction between an acid and base </h4><h4> 2) Rusting of iron </h4>\n" +
"<video width=\"620\" controls>\n" +
" <source\n" +
" src=\"/storage/3232-6333/demo/test.mp4\"\n" +
" type=\"video/mp4\">\n" +
" Your browser doesn't support HTML5 video tag.\n" +
"</video>";
webViewText = text;
WebSettings webSettings = webView.getSettings();
webSettings.setAllowFileAccessFromFileURLs(true);
//webSettings.setPluginState(WebSettings.PluginState.ON_DEMAND);
//webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptEnabled(true);
webSettings.setMediaPlaybackRequiresUserGesture(false);
//webSettings.setAppCacheMaxSize(25 * 1024 * 1024); // 25MB
//webSettings.setAppCachePath(mContext.getCacheDir().getAbsolutePath());
//webSettings.setAllowFileAccess(true);
//webSettings.setAppCacheEnabled(true);
//webSettings.setJavaScriptEnabled(true);
// load online by default
//webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
//if (!AndroidUtils.isNetWorkOnline(mContext)) { // loading offline
//webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
//}
webView.setWebChromeClient(new WebChromeClient());
webView.loadDataWithBaseURL("", webViewText, "text/html", "utf-8", "");
Я пытался с помощью всех вышеизложенных методов также установить настройки веб-просмотра, но не работает.
Я получаю сообщение ниже
08-29 18:34:36.551 28771-28888/com.gopal.webviewdemo W/VideoCapabilities: Unrecognized profile/level 0/2 for video/mpeg2
08-29 18:34:36.551 28771-28888/com.gopal.webviewdemo W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
08-29 18:34:36.591 28771-28888/com.gopal.webviewdemo I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
08-29 18:34:36.846 28771-28925/com.gopal.webviewdemo W/cr_CrashFileManager: /data/user/0/cpr.name.videoenabledwebview/cache/WebView/Crash Reports does not exist or is not a directory
08-29 18:34:36.849 28771-28771/com.gopal.webviewdemo I/chromium: [INFO:CONSOLE(0)] "The deviceorientation event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins for more details.", source: (0)
Любая помощь очень полезна. Заранее спасибо и извините за мой английский.