fix(android): Added fallback poster image to prevent crashes (#1036)

This commit is contained in:
Vladimir 2019-11-26 11:40:38 +02:00 committed by Thibault Malbranche
parent 71a375f898
commit d8acd9086c
1 changed files with 11 additions and 1 deletions

View File

@ -642,6 +642,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
if (mAllowsFullscreenVideo) {
int initialRequestedOrientation = reactContext.getCurrentActivity().getRequestedOrientation();
mWebChromeClient = new RNCWebChromeClient(reactContext, webView) {
@Override
public Bitmap getDefaultVideoPoster() {
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
}
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (mVideoView != null) {
@ -694,7 +699,12 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
if (mWebChromeClient != null) {
mWebChromeClient.onHideCustomView();
}
mWebChromeClient = new RNCWebChromeClient(reactContext, webView);
mWebChromeClient = new RNCWebChromeClient(reactContext, webView) {
@Override
public Bitmap getDefaultVideoPoster() {
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
}
};
webView.setWebChromeClient(mWebChromeClient);
}
}