AlexKMDev / WebRTC

Unofficial builds of Google WebRTC iOS Framework
https://webrtc.org/native-code/ios/
Other
292 stars 76 forks source link
ios ios-framework p2p webrtc

Deprecated!

Google now provides the official builds:

WebRTC iOS framework

[!] Please report all WebRTC related (not specific to this binary build) bugs and questions to discussion group or official bug tracker. You more likely to find professional help there.

Contents

Installation

[!] Bitcode is supported by the upstream, but Google source code builder (GN) produces ~700Mb binary with enabled bitcode, so it's hardly possible to distribute as a framework via CocoaPods/Carthage and that's why bitcode is disabled in my build. Follow corresponding issue there: https://bugs.chromium.org/p/webrtc/issues/detail?id=5085

Make sure to disable bitcode for your project: Go to your project's settings and find the Build settings tab, check All and search for bitcode, then set it to No.

If you encounter linker errors, try to add the framework to embedded binaries section.

CocoaPods (add to Podfile):

pod "WebRTC"

Carthage (add to Cartfile):

github "Anakros/WebRTC"

Manual: just download framework from the latest release and copy it to your project

You can only use the binary release, because the whole WebRTC repository takes ~12Gb of disk space

Usage

Swift

import WebRTC

let device = UIDevice.string(for: UIDevice.deviceType())

print(device)
print(RTCInitializeSSL())

Objective-C

@import WebRTC;

NSString *device = [UIDevice stringForDeviceType:[UIDevice deviceType]];

NSLog(@"%@", device);
NSLog(@"%d", RTCInitializeSSL());

Check out Official Example App!

Information

Built from https://chromium.googlesource.com/external/webrtc/ using tools_webrtc/ios/build_ios_libs.py script with following modifications (to enable x86 architecture):

diff --git a/tools_webrtc/ios/build_ios_libs.py b/tools_webrtc/ios/build_ios_libs.py
index 734f3e216..e6f250c97 100755
--- a/tools_webrtc/ios/build_ios_libs.py
+++ b/tools_webrtc/ios/build_ios_libs.py
@@ -165,8 +165,6 @@ def main():

   # Ignoring x86 except for static libraries for now because of a GN build issue
   # where the generated dynamic framework has the wrong architectures.
-  if 'x86' in architectures and args.build_type != 'static_only':
-    architectures.remove('x86')

   # Build all architectures.
   for arch in architectures:

Links

Official Example App

Official WebRTC Source Code Repository

WebRTC Homepage

WebRTC Discussion Group

WebRTC Bug Tracker

CocoaDocs

CocoaPods Page