fix(android): Added fallback poster image to prevent crashes (#1036)
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue