I have the following problem: I am using WebView
to display some content in my app. Sometimes there is a video which is embedded into the content which is presented in this WebView
. The problem is that after clicking "play", the video starts, but no image is visible - only sound is being played. Before starting the video - correct thumbnail is shown. In the LogCat I see following error messages:
06-26 16:51:21.449 25222-25222/com.package.app V/MediaPlayer-JNI﹕ native_setup
06-26 16:51:21.449 25222-25222/com.package.app V/MediaPlayer﹕ constructor
06-26 16:51:21.459 25222-25222/com.package.app V/MediaPlayer﹕ setListener
06-26 16:51:21.459 25222-25222/com.package.app I/MediaPlayer﹕ path is null
06-26 16:51:21.479 25222-25222/com.package.app D/MediaPlayer﹕ setDataSource IOException happend :
java.io.FileNotFoundException: No content provider: http://example.com/linktovideo.mp4
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1052)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:907)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:834)
at android.media.MediaPlayer.setDataSource(MediaPlayer.java:987)
at com.android.org.chromium.media.MediaPlayerBridge.setDataSource(MediaPlayerBridge.java:117)
at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
06-26 16:51:21.479 25222-25222/com.package.app D/MediaPlayer﹕ Couldn't open file on client side, trying server side
The same video is displayed correctly in the Chrome for Android web browser.
Code I use to display my WebView
:
mWebView = (WebView) v.findViewById(R.id.details_web_view);
mWebView.getSettings().setJavaScriptEnabled(false);
mWebView.setBackgroundColor(0x00000000);
mWebView.setWebViewClient(new CustomWebViewClient());
mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
CustomWebViewClient:
private class CustomWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url != null && url.startsWith("http://")) {
getActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
AnalyticsHandler.sendAction(getActivity(), AnalyticsHandler.ACTION_CLICKED_ON_URL_IN_ARTICLE, url);
}
return true;
}
}
try