A simple native WebRTC demo iOS app using swift
APACHE-2.0 License
A simple native WebRTC demo iOS app using swift.
This demo app's purpose is to demonstrate the bare minimum required to establish peer to peer connection with WebRTC. This is not a production ready code! In order to have a production VoIP app you will need to have a real signaling server (not a simple broadcast server like in this example), deploy your own Turn server(s) and probably integrate CallKit and push notifications.
Legacy xcode support:
WebRTC-Demo-app
folderWebRTC-Demo.xcworkspace
Config.swift
and set the defaultSignalingServerUrl
variable to your signaling server ip/host. Don't use localhost
or 127.0.0.1
if you plan to connect other devices in your network to your mac.1. Navigate to the `signaling/NodeJS` folder.
2. Run `npm install` to install all dependencies.
3. Run `node app.js` to start the server.
Note: This step requires MacOS 10.15
1. Navigate to the `signaling/Swift` folder.
2. Run `make`
3. Run `./server` to start the server
Alternative method: Open WebRTC-Demo.xcworkspace
and run the SignalingServer
scheme.
Disclaimer: I am not sure if this is the best way doing it but this has worked for me so far:
RTCAudioSession.sharedInstance().useManualAudio = true
RTCAudioSession.sharedInstance().isAudioEnabled = false
CXProvider
delegate's provider(CXProvider, didActivate: AVAudioSession)
method:
RTCAudioSession.sharedInstance().audioSessionDidActivate
with the AVAudioSession
from the CXProvider
RTCAudioSession.sharedInstance().isAudioEnabled = true
CXProvider
delegate's provider(CXProvider, didDeactivate: AVAudioSession)
call RTCAudioSession.sharedInstance().audioSessionDidDeactivate
with the AVAudioSession
from the CXProvider
WebRTC and CallKit talk from 2016: https://youtu.be/JB2MdcY1MKs?t=6m23s