joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.81k stars 772 forks source link

Fetch webView video with self certificate #610

Closed KrifaYounes closed 4 years ago

KrifaYounes commented 4 years ago

It's possible to load video in webView using RNFetchBlob.config with trusty config = true ?

<WebView

                                    ref={ref => (this.webview = ref)}
                                    javaScriptEnabled={true}
                                    domStorageEnabled={true}
                                    renderLoading={() => loadingCamera}
                                    style={{backgroundColor: 'transparent'}}
                                    automaticallyAdjustContentInsets={true}
                                    scalesPageToFit={true}
                                    contentInset={{top: 0, right: 0, left: 0, bottom: 0}}
                                    scrollEnabled={false}
                                    source={{uri: 'http://192.191.9.9:9000/video_feed'}} />

RNFetchBlob.config({
  trusty : true
})
.fetch('GET', 'https://mysite.com')
.then((resp) => {
  // ...
})
KrifaYounes commented 4 years ago

Fixed by using

@Override public void onReceivedSslError(WebView webView, SslErrorHandler handler, SslError error) { if (error.toString() == "piglet") handler.cancel(); else handler.proceed(); // Ignore SSL certificate errors }