openvidu-ios 🔗

openvidu-ios sample application is a paid feature. Contact us through Commercial support to get it

A client-side only iOS native application built with Swift and using official Google WebRTC library.

If it is the first time you use OpenVidu, it is highly recommended to start first with openvidu-hello-world tutorial due to this being a native iOS app and being a little more complex for OpenVidu starters.

OpenVidu does not provide an iOS client SDK yet, so this application directly implements OpenVidu Server RPC protocol. In other words, it internally implements what openvidu-browser library does. Everything about this implementation is explained in section Using OpenVidu Server RPC protocol

openvidu-ios features 🔗

Feature Enable
OpenVidu compatibility from 2.15.0
Latest iOS versions
OpenVidu RPC protocol
Mute / Unmute video
Mute / Unmute audio
Toggle speaker / headset
Subscribe / unsubscribe stream

Understanding this tutorial 🔗

OpenVidu is composed by the three modules displayed on the image above in its insecure version.

  • openvidu-ios: iOS application built with Swift connected to OpenVidu through websocket
  • openvidu-server: Java application that controls Kurento Media Server
  • Kurento Media Server: server that handles low level operations of media flow transmissions

Running this tutorial 🔗

This tutorial has been tested using Xcode 12, iPhone 7 and 7 Plus devices (iOS 14).

To run the iOS app you need Xcode and an iOS device. You can download Xcode here.

After we have set up Xcode we must continue with the following commands:

1) Install dependencies under ./openvidu-ios/openvidu-ios

pod update
pod install

2) Open Xcode and import the project (openvidu-ios.xcworkspace)

3) By default, this app is pointing to our demo server (https://demos.openvidu.io). You can change the OPENVIDU_URL value in openvidu-ios/openvidu-ios/constants/JSONConstants.swift. If you want to set and launch OpenVidu locally, continue with point 4. If you don't, go to point 8.

4) Now you need the IP of your PC in your LAN network, which we will use in points 5) and 6) to configure OpenVidu Server and your app. In Linux/OSX you can simply get it by running the following command on your shell (will probably output something like 192.168.1.111)

awk '/inet / && $2 != "127.0.0.1"{print $2}' <(ifconfig)

5) OpenVidu Platform service must be up and running in your development machine. The easiest way is running this Docker container which wraps both of them (you will need Docker CE). Set property DOMAIN_OR_PUBLIC_IP to the IP we just got in point 4). In the example below that would be replacing -e DOMAIN_OR_PUBLIC_IP=YOUR_OPENVIDU_IP to -e DOMAIN_OR_PUBLIC_IP=192.168.1.111

# WARNING: this container is not suitable for production deployments of OpenVidu Platform
# Visit https://docs.openvidu.io/en/stable/deployment

docker run -p 4443:4443 --rm -e OPENVIDU_SECRET=MY_SECRET -e DOMAIN_OR_PUBLIC_IP=YOUR_OPENVIDU_IP openvidu/openvidu-server-kms:2.16.0

6) In Xcode Studio, you must also indicate the OpenVidu Server URL to the app. Check the point 3.

7) Connect the device to the same network as your PC.

8) Connect the device to the PC. You will need to sign your application in Xcode with your developer team to avoid any errors. From Apple official documentation.

9) Run the tutorial. In Xcode, click on the Play button after selecting your connected device.