Talk to us
Talk to us

Blog Post

start building

How To Build iOS Apps Using WebRTC

How To Build iOS Apps Using WebRTC

WebRTC implements webpage-based video conferencing. The standard is the WHATWG protocol. The purpose is to provide real-time communication (Real-Time Communications (RTC)) capabilities by providing simple javascript through the browser.

Native applications such as iOS and Android can use WebRTC capabilities through the embedded Webview solution to help you quickly build full-platform WebRTC applications.

This article will explain how to use WebRTC to build iOS applications.

Introduction to Video Conference Kit

This article will use ZEGOCLOUD’s UIKits to explain how to quickly use WebRTC to build Android and iOS audio and video applications.

UIKits is a prebuilt feature-rich component, which enables you to build video communication into your web and mobile apps in minutes.

And it includes the business logic with the UI, and you can customize various video communication features by modifying parameters.

Building iOS Apps with WebRTC

let’s explain how to use WebRTC on the iOS platform.

1. Create a project

First, you need to create a new project through Xcode.

  • You need to select File -> New -> Project -> App to create an iOS project.
    create ios project
  • Set the project name to myWebviewWebRTC, click next to complete the project creation.
set ios project name

2. Device Permission Application

Next, you need to add permission requests for the camera and microphone in info.plist.

You need to fill in the following code in the info.plist file.

<string>We require camera access to connect to a video conference</string>
<string>We require microphone access to connect to a video conference</string>

3. Implement audio and video call function

Finally, you only need to create a WKWebView instance and use it to load the WebRTC application to realize the audio and video application on the iOS side.

   import UIKit
   import WebKit

   class ViewController: UIViewController, WKUIDelegate {

       var wkwebview: WKWebView!

       override func viewDidLoad() {
           let request = URLRequest(url: URL(string: "")!)
       override func loadView() {
               let webConfiguration = WKWebViewConfiguration()
               webConfiguration.allowsInlineMediaPlayback = true //** Added as an example for your case
               wkwebview = WKWebView(frame: .zero, configuration: webConfiguration)
               wkwebview.uiDelegate = self
               view = wkwebview

4. Run a demo

Next, you can run the project and experience your audio and video applications on the iOS side.

webrtc ios demo

You can also learn how to use WebRTC on iOS by downloading sample code.


Before the emergence of WebRTC, you need to install plug-ins and clients for real-time communication. These operations are complex and prone to problems. Now WebRTC technology is built into the browser, and users do not need to use any plug-ins or software. Realize real-time communication.

Using Webview to quickly integrate WebRTC is becoming more popular with application developers because it can save them a lot of time and money.

ZEGOCLOUD With our fully customizable and easy-to-integrate Live SDK, you can quickly build reliable, scalable, and interactive live streaming into your mobile, web, and desktop apps.

Related posts