Skip to main content
Version: 0.3.x

Quickstart with iOS webview

Prebuilt SDK enables the opportunity to integrate real-time video & audio communication SDK without writing explicit code. It just requires 10 minutes to integrate.

Prerequisites​

important

One should have a VideoSDK account to generate a token. Visit VideoSDK dashboard to generate token

Permissions​

In order to embed VideoSDK in iOS, add these permissions to the Info.plist:

<key>NSCameraUsageDescription</key>
<string>Allow camera access to start video.</string>

<key>NSMicrophoneUsageDescription</key>
<string>Allow microphone access to start audio.</string>

Embeding Prebuilt in iOS​

You will need to use the SFSafariViewController class.

  1. We will setup the SFSafariViewController to load the VideoSDK Prebuilt when the view appears.
import SafariServices

class ViewController: UIViewController, SFSafariViewControllerDelegate {

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
var meetingUrl = URLComponents() // We will update the URL in next step
let safariVC = SFSafariViewController(url: meetingUrl.url!)
safariVC.delegate = self
present(safariVC, animated: true)
}
}
  1. Next step is to update the URL for the prebuilt. Make sure you replace the token and meetingId with respective variables.
import SafariServices

class ViewController: UIViewController, SFSafariViewControllerDelegate {

public var prebuiltVersion = "0.3.43" // VideoSDK Prebuilt Version
public var token = "YOUR_TOKEN_HERE" //Replace your token here
public var meetingId = "YOUR_MEETINGID" //Replace your meeting id

public var name = "John Doe"
public var webcamEnabled = "true"
public var micEnabled = "true"

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
var meetingUrl = URLComponents()

//Setup the Prebuilt URL
meetingUrl.scheme = "https"
meetingUrl.host = "embed.videosdk.live"
meetingUrl.path = "/rtc-js-prebuilt/"+prebuiltVersion
meetingUrl.queryItems = [
URLQueryItem(name: "name", value: name),
URLQueryItem(name: "micEnabled", value: micEnabled),
URLQueryItem(name: "webcamEnabled", value: webcamEnabled),
URLQueryItem(name: "meetingId", value: meetingId),
URLQueryItem(name: "token", value: token),
]
let safariVC = SFSafariViewController(url: meetingUrl.url!)
safariVC.delegate = self
present(safariVC, animated: true)
}
}
  1. Run the app.
note

You can checkout the sample project for prebuilt implementation of iOS in webview here.

Got a Question? Ask us on discord