Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 2.15 KB

BuildingLibWebRTC.md

File metadata and controls

61 lines (43 loc) · 2.15 KB

Build libwebrtc for cordova-plugin-iosrtc

Get the libwebrtc source code

There are several ways to get and build the library. We choose a project that performs this task nicely:

$ git clone https://github.com/pristineio/webrtc-build-scripts
$ cd webrtc-build-scripts
  • Follow the project steps and fetch the libwebrtc source code:
$ source ios/build.sh
$ WEBRTC_RELEASE=true
$ get_webrtc
  • Set a specific libwebrtc version:
$ update2Revision 11063

Apply libwebrtc-objc-iosrtc.patch

Google's libwebrtc Objective-C code lacks of addtrack and removetrack events in its RTCMediaStream class, making imposible to emulate them at JavaScript level. Thus a patch is needed to enable these W3C WebRTC features.

eFace2Face created such a patch and sent it to the Google's WebRTC project, but it was rejected by arguing that the future of the WebRTC API is "track based" rather than "stream based".

Since we live in the present we need those two events to properly implement the W3C WebRTC API in cordova-plugin-iosrtc, and hence the patch is provided in the source code.

  • Apply the patch provided at extra/libwebrtc-objc-iosrtc.patch into the Objective-C source code of libwebrtc:
$ cd ios/webrtc/src/talk/app/webrtc/objc
$ patch -p1 < PATH_TO_CORDOVA_PLUGIN_IOSRTC/extra/libwebrtc-objc-iosrtc.patch

Build libwebrtc

  • Go back to the webrtc-build-scripts root folder and build libwebrtc:
$ cd ../../../../../../../
$ build_webrtc
  • Copy the libwebrtc Objective-C headers to cordova-plugin-iosrtc:
$ rm -f PATH_TO_CORDOVA_PLUGIN_IOSRTC/src/webrtc-headers/*
$ cp ios/webrtc/src/talk/app/webrtc/objc/public/* PATH_TO_CORDOVA_PLUGIN_IOSRTC/src/webrtc-headers/
  • Copy the libwebrtc static library to cordova-plugin-iosrtc:
$ rm -f PATH_TO_CORDOVA_PLUGIN_IOSRTC/lib/*
$ cp ios/webrtc/libWebRTC-LATEST-Universal-Release.a PATH_TO_CORDOVA_PLUGIN_IOSRTC/lib/