mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-08-31 11:41:08 +00:00
fix(android): Added fallback poster image to prevent crashes (#1036)
This commit is contained in:
committed by
Thibault Malbranche
parent
71a375f898
commit
d8acd9086c
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user