Below are the recommended approaches to embed a Whereby room depending on the iOS version.
We offer native SDKs that allow you to tap into powerful features such as listening to room events and use custom buttons to send commands to the room from your application.
Read more
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 a browser (Safari by default) for iOS versions lower than 14.3:
importUIKitclassViewController:UIViewController {publicvar roomUrlString =""// Replace by your ownoverridefuncviewDidLoad() { super.viewDidLoad()guardlet roomUrl =URL(string: roomUrlString), UIApplication.shared.canOpenURL(roomUrl)else {return } UIApplication.shared.open(roomUrl) }}sw
Handling multiple iOS versions
Here is an example on how to handle different solutions, depending on the iOS version:
if#available(iOS14.5, *) {// Use WKWebView} elseif#available(iOS14.3, *) {// Use SFSafariViewController} else {// Redirect to browser app}
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