Embedding Whereby in iOS
Below are the recommended approaches to embed Whereby in a native iOS app using a WebView.
WebViews are powerful built-in components that allow loading URLs within a native app. When embedding Whereby, depending on your implementation, you can use the following types of URLs:
A Whereby room URL (which takes the user directly to the Whereby pre-call screen).
A custom web app that embeds Whereby using the Embedded element.
A React app that embeds Whereby with the React Hooks SDK.
This solution is based on Whereby Web
, which provides advanced tools such as integrations and breakout groups. However, we also offer a native iOS SDK that allows you to customize the user experience in your iOS app. With the iOS SDK, you can create custom iOS UIButtons and UIViews, send commands to the room, and listen to room events to implement custom callbacks.
Read more
Permissions
Ensure the following permissions are declared in your Info.plist
file:
NSMicrophoneUsageDescription - Microphone Access
NSCameraUsageDescription - Camera Access
NSPhotoLibraryUsageDescription - Photo Library Access (for file sharing)
NSPhotoLibraryAddUsageDescription - Photo Library Additions (for file sharing)
WKWebView (WebKit)
WKWebView supports embedding pages that use WebRTC from iOS 14.5 onwards. Below is a basic example of how to implement a WKWebView.
This is a minimal implementation that sticks to the default behavior of WKWebView. It is recommended to extend the configuration by implementing delegate methods to improve the user experience. For example, you can:
Avoid repeated media permission prompts.
Enable and manage file sharing.
Handle external link redirections.
For a complete example, check out our public repository: ios-webview-demo.
SFSafariViewController
For iOS 14.3 and 14.4, use SFSafariViewController to open a website containing an iframe with its src
specified as a Whereby room, alongside a custom user interface:
Redirect to browser
Redirect to a browser (Safari by default) for iOS versions lower than 14.3:
Handling multiple iOS versions
Here is an example on how to handle different solutions, depending on the iOS version:
When the app is sent to background, the camera is disabled. If you need the microphone to continue working while the app is in the background, we recommend redirecting to Safari app.
To use Whereby with Cordova (Phonegap) please use the plugin for SafariViewController
Last updated
Was this helpful?