WebView Integration

To integrate the Uqudo Web SDK into your WebView implementation, follow the guide below :

Requirements

  • Enable JavaScript in WebView

  • Enable allowsInlineMediaPlayback in your IOS Webview implementation

  • Enable DOM storage in Android. In iOS should be enabled by default

  • In Android, it is recommended to use WebChromeClient to handle camera access within a WebView.

Camera permission considerations

Android

On Android, you need to declare permissions in AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />

And at runtime (for Android 6.0+), you need to explicitly request the permission:

ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);

Note: Do not open the WebView if camera permission has not been granted, as camera functionality will not work. You need to manage permissions beforehand.

Within the WebView client, even if the application-level camera permission is granted, you must also explicitly approve permission requests for RESOURCE_VIDEO_CAPTURE. As mentioned earlier, this approval will only succeed if the app has already been granted camera permission. See the example below for reference.

iOS

If you use Safari WebView (SafariViewController) you can ignore the settings below. If you use WebKit WebView (WKWebView) you need to follow the instructions below:

Add the following key to your Info.plist:

Note: Do not open the WebView if camera permission has not been granted, as camera functionality will not work. You need to manage permissions beforehand.

React-Native or Flutter

When using WebView plugins with React Native or Flutter, camera permissions are typically handled by the plugin. However, if you want to control permissions before launching the WebView, you may need to manage them manually. Be sure to thoroughly test all possible scenarios to ensure consistent behavior.


Important Note: The end-user will encounter two separate camera permission prompts, one at the application level and another within the WebView. It’s essential to clearly inform users that both permissions must be granted for the application to function properly. Additionally, on iOS, if the user denies the WebView-level permission, the denial is remembered for the duration of the session. In such cases, the application must be restarted to trigger the WebView permission prompt again.

Implementation examples

Android - JAVA

Android - Kotlin

iOS - Swift

React Native

Flutter

Xamarin (C#):

Load Uqudo Web SDK URL

Make sure to load the URL of the Uqudo Web SDK into your WebView. Replace "https://your-uqudo-sdk-url.com" with the actual URL of your Uqudo Web SDK.

Feel free to customize the examples provided according to your specific implementation needs. If you encounter any issues or have further questions, refer to the Uqudo Web SDK documentation or reach out to our support team for assistance.

Last updated

Was this helpful?