146
How to get started with WebRTC and iOS without wasting 10 hours of your life

How to get started with WebRTC and iOS without wasting 10 hours of your life

(Updated 11/3/2014)

I recently had the chance to play around with the new WebRTC framework, a really cool new technology that will eventually allow for point-to-point real-time video chat without plug-ins or extra software. Ideally this technology will be built into all modern browsers (it’s already in Chrome and Firefox!) but Apple is definitely dragging their feet. If you want to incorporate this technology into an iOS application, you need to directly use the WebRTC libraries that implement the protocol. Fortunately, an Objective-C implementation of just about everything exists and is free to use.

That being said, incorporating the WebRTC libraries into your project is a total nightmare. The project is set up to support a large number of platforms simultaneously, so the build system is extremely complicated. Forget about opening Xcode and using interface builder, you are going to be doing everything from the command line if you want to work directly with the libraries.

Why not just take the compiled libraries and build on top of them? WebRTC is still on the bleeding edge of development, and changes are being made to the framework almost every day. Until a stable release point is reached, you will need to pull in the latest library changes as they happen in order to stay on top of development.

If you are building a production application then you are going to need to get down in the guts and work directly with the libraries, and in order to compile them you need to jump through a bunch of hoops (especially if you are working with Xcode 5 and iOS 7). It took a surprising amount of effort to get this to build for the simulator, and then trying to get it to build for a device was even more work. In hopes of saving other people some time, here’s a compilation of all the steps I needed to do to get the example application building and then running on both the iOS simulator and a physical device.

 

Get the code base

Keep in mind that at the time of this writing, this is a project being very actively developed. It’s very likely the build process is going to change as time goes on. These instructions are based on syncing the code base at revision r7538.

Prerequisites:

  • I’m doing this on a MacBook Pro running OS X Mavericks
  • You have Git installed and working
  • XCode 5.1+ with the Command Line Tools installed (Preferences -> Downloads -> Command Line Tools)
  • If you’re using an actual iOS device, you will need a valid development code signing identity, and properly provisioned iOS device attached to your computer

1) Create a working directory

Make a new directory somewhere,  and get ready because you’re going to need in the ballpark of 8 GB of free space

2) Download the Chromium depot tools

Switch into your working directory and grab the Chromium depot_tools repository with git:

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

These are a bunch of tools used during the build process, and they will need to be in your path so you will need to modify your .bash_profile (or other shell file) and modify the PATH line like so:

export PATH=/a_bunch_of_stuff:/working_directory/depot_tools:$PATH

Next you will need to restart your terminal or re-run your bash profile so that the changes take effect:

source ~/.bash_profile

3) Download the WebRTC source

Back in your working directory, use the next few commands to download the massive source repository:

gclient config --name src http://webrtc.googlecode.com/svn/trunk
echo "target_os = ['ios']" >> .gclient
gclient sync --force

Come back a few days later when it’s finished downloading, and then you can move on to setting up the build.

 

Building and running on the iOS 7/8 simulator

This source code is capable of building for a number of different platforms, and since we are only interested in building for iOS we are going to create our own build script that compiles and runs exclusively for the iOS simulator.  That’s right, forget about actually using Xcode we are going to be building everything from the command line. Oh yeah!

First, at the top level of your working directory create a new shell script file to kickoff the build:

touch build_apprtc.sh
chmod +x build_apprtc.sh

Open the file you just created, and paste in this:

This script contains a few functions that allow you to build the AppRTC example app for a few different purposes. First, build the source code and example application by running the script with the following parameter:

./build_apprtc.sh build_iossim

Once the build has completed successfully, launch the iOS simulator and run the example application by using the following parameter:

./build_apprtc.sh run_simulator

Your iOS simulator should pop up automatically and launch the test application. To give it a try, you’re going to have to create a video session that the test application can connect to. The easiest way to do this is:

1) Open a Chrome browser tab on your computer or Android device (I’ve had great success with the Google Nexus 7 and 10).

2) Go to http://apprtc.appspot.com

3) Give the browser permissions to access your camera, and wait for your smiling face to show up.

4)  Notice that the URL in your browser has changed. It will now look something like this:

http://apprtc.appspot.com?r=87514723

5) The number appended to the end of the URL is the room number. This is the key piece of information you need to get the test application to connect. Switch back to the iOS simulator, and type that number into the text box. Press the join button on the keyboard and away it will go. The test application has not been the most reliable thing in the world for me, see you might need to try a few times before it connects successfully. Also be careful with the volume on your computer, it’s super easy to get a feedback loop going.

We have a demo! Now let’s see if we can get this thing to work on an actual iOS device.

 

Building and running directly on an iOS device

To build the test application for an actual iOS device, use the following parameter:

./build_apprtc.sh build_iosdevice

The script will switch the architecture to armv7 and codesign the application. In order to upload the compiled application to an attached iOS device, we need to install an additional tool called ideviceinstaller.  Its super-easy to install using homebrew (although it takes a while to build).

brew install ideviceinstaller --HEAD

Once that tool is installed, you can use another parameter on the build script to install and run the application on your attached iOS device:

./build_apprtc.sh run_on_device

Curveball: IOS 7

(NOTE: the latest revisions of the framework have solved this problem, so you can skip this step. I’m leaving the solution here for those that run into it)

The build scripts were designed with iOS 6 in mind, and include an obsolete framework not available in the iOS 7 SDK.  Building the code for an actual iOS device will spit out an error that reads something like “ld: framework not found IOKit”. Fortunately, fixing this problem is as easy as deleting a few lines. Open src/talk/libjingle.gyp and search for:

framework IOKit

There should be 2 instances of that in the file, just delete both of those lines.

Curveball: Codesigning

The build scripts will look through your keychain and use the code signing identity associated with “iPhone developer”. If you have a single identity registered (i.e. you only ever work with one team or developer account) everything should be fine.  If this is you, skip down to the “finally” section below.

If you do not have a valid code signing identity set up & a provisioned iOS device attached to your computer, it’s not going to work.  Follow Apple’s guides on how to create an identity and provisioning profile.

If you are an iOS developer that works with multiple clients, odds are that you have multiple code signing identities for the identity “iPhone developer”. The WebRTC build scripts do not have proper handling for this situation, and will throw assertions if you have more than one code signing identity. Fortunately, we can modify the global build configuration to specify the exact code signing identity to use.

First, find the list of valid code signing identities that are available by running this from the command line:

security find-identity

You should see a block of output with all of your valid (and expired) identities. Look for the block at the bottom titled “Valid identities only”

Valid identities only
1) 34F3D92F755F343C9E05AE207ECDAD47C4183D77 "iPhone Developer: Jason Adams (SZ2V5SDF5DF)"
2) 257CA472EB76BE93AED28FEDE8FE7179A3B126EF "iPhone Distribution: My Company (FG45D44FR34)"
3) 1909558E0478D5CB13929AE30A20380EB47383E6 "iPhone Developer: Jason Adams (S56FDFPBY4)"
3 valid identities found

Choose the identity most appropriate for this project, and copy the text between the quotation marks on the corresponding line. Next, open the global configuration file src/build/common.gypi and search for the text ‘CODE_SIGN_IDENTITY’. It should occur around line 4830:

# iOS SDK wants everything for device signed
‘CODE_SIGN_IDENTITY[sdk=iphoneos*]‘: ‘iPhone Developer’

Switch the identity value with the one you chose from the valid identity list:

# iOS SDK wants everything for device signed
‘CODE_SIGN_IDENTITY[sdk=iphoneos*]‘: ‘iPhone Developer: Jason Adams (SZ2V5SDF5DF)’

By default, the test application will be built with a bundle ID of com.google.AppRTCDemo. If the signing identity & associated provisioning profile is restricted to a specific bundle ID or wildcard, you might need to switch the test project bundle ID to match (You will see the error “Install – Error occured: ApplicationVerificationFailed” if this is the case). To do that, open the file src/talk/examples/objc/AppRTCDemo/ios/Info.plist and change the following lines to match whatever bundle ID you need:

Save the file, and kick off the build again. Otherwise, the build will fail with an error similar to “AssertionError: Multiple codesigning identities for identity: iPhone Developer”.

If you are still having trouble with the build choosing the right provisioning profile for the device you are working with, you can take a look at the provisioning profile that was chosen for you with the following command:

security cms -D -i src/out_ios/Release-iphoneos/AppRTCDemo.app/embedded.mobileprovision

NOTE: If you are switching bundle IDs, the build might not automatically pick up the changes. The best way to make sure it rebuilds the test app with the new bundle ID is to delete the output directory at src/out_ios/

If the build is pulling in the wrong provisioning profile even though you have the correct codesigning identity specified, there is a way to manually replace the embedded provisioning profile from the compiled AppRTCDemo.app with the following steps. It’s better to figure out the upstream problem though, since you would have to do this every single time you compile. If you really must do this every time, then you can add the following commands into the end of your makeall-iosdevice.sh script.

1) Delete the existing code signature from the compiled app

rm -rf src/out_ios/Release-iphoneos/AppRTCDemo.app/_CodeSignature/

2) Copy in a new provisioning profile to use, assuming it is sitting in your downloads directory

cp ~/Downloads/my_personal.mobileprovision src/out_ios/Release-iphoneos/AppRTCDemo.app/embedded.mobileprovision

3) Re-codesign the application using the signing identity that corresponds to the provisioning profile you just copied

codesign -f -s "iPhone Developer: Jason Adams (SZ2V5SDF5DF)" --resource-rules src/out_ios/Release-iphoneos/AppRTCDemo.app/ResourceRules.plist src/out_ios/Release-iphoneos/AppRTCDemo.app

4) Install the newly-signed application onto your device

ideviceinstaller -d -i src/out_ios/Release-iphoneos/AppRTCDemo.app

Finally!

If everything goes well, the upload will succeed and you’ll notice a new demo application icon show up on your device. The build script will not automatically launch the application, so just click on the icon to run the demo. From there follow the same instructions to join a chat room as we did with the simulator.

Debug Mode

To build the libraries in debug mode instead of release mode, all you need to do is replace every instance of “out_ios/Release-” with “out_ios/Debug-” in my build scripts. The build environment will notice that change and use the appropriate optimization levels.
 

Making Code Changes

There is a ton of code here, but there’s really only a small amount that you need to worry about as an iOS developer. Here are the 2 key locations to start exploring:

AppRTCDemo test project – src/talk/examples/objc

This is the demo application with the high level communication logic and UI

Objective-C WebRTC libraries – src/talk/app/webrtc/objc

These are the Objective-C wrappers to the core communication libraries.

As long as you modify the code in place, the build scripts will automatically tie everything together and compile the finished demo application.

Incorporating WebRTC into Your Custom iOS Application

If you are building an application on top of the WebRTC framework, you don’t really want to mess around with the raw WebRTC source code if you can avoid it. What you really want is the compiled code in a static library that you can just throw into your XCode project. Fortunately for you, the build script will take care of this as well. Use the following parameter to build the libraries for both x86 & armv7 and then combine all of the compiled objects into a single fat library:

./build_apprtc.sh build_all

This will spit out a file named libWebRTC.a into your working directory. Drag this file into your XCode project along with the public headers found here:

src/talk/app/webrtc/objc/public/*.h

Additionally, you will need to add a few frameworks to your project in order for it to build correctly:

libc++.dylib
libicucore.dylib
Security.framework
CFNetwork.framework
GLKit.framework
libstdc++.6.dylib
AudioToolbox.framework
AVFoundation.framework
CoreAudio.framework
CoreMedia.framework
CoreVideo.framework
CoreGraphics.framework
OpenGLES.framework
QuartzCore.framework
libsqlite3.dylib

Also note that the WebRTC libraries currently only build for armv7 and x86. The standard architectures defined for a new XCode project expect armv7s & arm64. Your application build will fail at the moment unless you manually limit your project to only build for those architectures. Apple recently announced that arm64 is going to be required in applications submitted to the app store in the near future, so let’s hope the WebRTC libraries are updated to support that soon!

Enjoy playing around with the project, and definitely let me know if you learn any other tips or tricks.

 

Need Help?

We can help you get your WebRTC application working for iOS or Android.

 

19

Comments 146

  1. This is a really excellent guide, I’d had wished it was available when I was going through the same troubles getting webrtc running on IOS. Thank you very much for this, I expect this will save a lot of people a lot of time!

    Reply
  2. Hello,
    Thanks a lot for this, painless way to build webrtc on IOS!

    I’m trying to add a video chat on an existing app, Do you have any advice on using this work as a library in a different project ?

    thanks

    Reply
    • @Nick

      Hi Nick,

      Thanks! There’s not a very clean way to do that at the moment, but I think a great place to start would be to look at this project:

      https://github.com/gandg/webrtc-ios

      I think the basic idea is to build the libraries using the command line tools, and then either copy or symlink the *.a files from the trunk/out_ios directories into your larger project. That’s essentially what they did there (Note that this particular GitHub project does not build the libraries, but all of the code is there for reference).

      Reply
  3. I always fail at last steps. the verification. I tried other app direct from xcode, no issue.

    Install – Error occured: ApplicationVerificationFailed

    Did any one meet similar issue before? Any suggestion for it?

    Thanks in advance

    Reply
  4. hi,jason,i have some questions about the example application on ios, your answer will be so appreciated
    1.what’s the different between your steps and the “great starting point” one:https://github.com/gandg/webrtc-ios
    2.i have build the “great starting point” one on iphone and type the room number then apply, but i get nothing but a red rectangle on screen.what happened?
    3.does the example application on ios support video capture and sending or video recieving or both of them?
    4.the googls says(http://www.webrtc.org/reference/getting-started):”On mac, Open trunk/talk/examples/peerconnection/server/server_test.html. Click connect. Observe that the peerconnection_server announces your connection. Now you can open one more tab with the page, connect that too (with a different name) and send messages between the peers.” i tried this and found that this webpage example using xmlhttprequest as the signalling channel, which is different from the room number method. is it possible to use the xmlhttprequest method instead of the room number method on the ios example application?how to do that?

    Thanks a lot!

    Reply
    • @ted

      Hi Ted, see below:

      1. The http://webrtc.googlecode.com/svn/trunk code will give you the latest official WebRTC framework codeBase, but the example iOS implementation there only supports audio. The https://github.com/gandg/webrtc-ios project has taken a snapshot of the official code base and added a *very* basic video implementation on top of it.

      2. First, keep in mind that project only works on actual iOS devices, it will not work on the simulator. Second, at this point in time (December 2013) the WebRTC framework is not very stable on iOS. It has not been unusual for me that a video connection can only be established 1 out of every 8 times I try.

      3. The https://github.com/gandg/webrtc-ios project supports both sending and receiving video, although at the moment only the received video will show up on the device screen (not the local camera).

      4. I have only tested using http://apprtc.appspot.com so unfortunately I’m not sure how to help you with the test page you are talking about.

      Reply
  5. @Jason

    Thank you very much for giving other people instructions on how to finish this project, it’t been great following your tips. Anyway, I am trying to do a group video chat application on iOS like @Nick, so I was wondering if you could explain a bit more about how to incorporate this project into my existing code, because I am using Xcode and here we are doing shell commands. Also I have looked at this project https://github.com/gandg/webrtc-ios, how ever it does not really build and run in my Xcode, I get like 9 errors and stuff. Your help would be much appreciated! It’ll be great if you can send me your email address so we can get in touch. Thanks again!

    Reply
    • @Borui

      Hi Borui,

      Unfortunately I think for most production applications you will be stuck having two builds:

      * One to build the raw libraries through the command line scripts
      * One that builds your actual application in XCode and just links in those pre-built libraries.

      Ideally, you shouldn’t have to mess with the libraries so often unless you want to pull in the latest changes from upstream. That’s basically what the Github project you mentioned has done.

      Reply
  6. Fantastic blog Jason, thank you for this.

    I’m trying it with Xcode 5.0.2 (5A3005), and iOS 7, but when I run ./makeall-iossim.sh, I get the following build error. Any suggestions?

    llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags

    Context:
    $ ./makeall-iossim.sh

    ninja: Entering directory `out_ios/Debug-iphoneos’
    [23/2038] CC obj/third_party/nss/nspr/pr/src/linking/nspr.prlink.o
    FAILED: /usr/bin/gcc-4.2 -MMD -MF obj/third_party/nss/nspr/pr/src/linking/nspr.prlink.o.d -DANGLE_DX11 -DDISABLE_NACL -DV8_DEPRECATION_WARNINGS -DCHROMIUM_BUILD -DUSE_LIBJPEG_TURBO=1 -DENABLE_INPUT_SPEECH -DENABLE_EGLIMAGE=1 -DCLD_VERSION=1 -DENABLE_SPELLCHECK=1 -DDISABLE_FTP_SUPPORT=1 -D_NSPR_BUILD_ -DFORCE_PR_LOG -DXP_UNIX -DDARWIN -DXP_MACOSX -D_PR_PTHREADS -DHAVE_BSD_FLOCK -DHAVE_DLADDR -DHAVE_LCHOWN -DHAVE_SOCKLEN_T -DHAVE_STRERROR -DNSPR_STATIC -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -DDEBUG -D_DEBUG -I../../third_party/nss/nspr/pr/include -I../../third_party/nss/nspr/pr/include/private -I../../third_party/nss/nspr/lib/ds -I../../third_party/nss/nspr/lib/libc/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -O0 -gdwarf-2 -fvisibility=hidden -Wnewline-eof -miphoneos-version-min=6.0 -arch armv7 -Wendif-labels -Wno-unused-parameter -Wno-missing-field-initializers -Wheader-hygiene -Wno-c++11-narrowing -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-deprecated-register -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-c++11-narrowing -Wno-deprecated-declarations -Wno-incompatible-pointer-types -Wno-pointer-sign -I/opt/local/include -O2 -arch x86_64 -std=c99 -Xclang -load -Xclang /Users/jtosey/ws/google-webrtc/trunk/tools/clang/scripts/../../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -fcolor-diagnostics -c ../../third_party/nss/nspr/pr/src/linking/prlink.c -o obj/third_party/nss/nspr/pr/src/linking/nspr.prlink.o

    llvm-gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags

    [23/2038] CXX obj/webrtc/modules/pacing/paced_sender.paced_sender.o
    ninja: build stopped: subcommand failed.

    Reply
    • @Joseph

      Thanks Joseph!

      You might have a typo in your build script, are you trying to build for the simulator or an actual device? The filename of your build script implies the simulator to me, but it looks like it’s specifying the armv7 architecture which probably will not work.

      Double check your build script, especially this function if you are trying to build for the simulator:

      function wrsim() {
      wrbase
      export GYP_DEFINES=”$GYP_DEFINES OS=ios target_arch=ia32″
      export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_sim”
      export GYP_CROSSCOMPILE=1
      }

      Reply
  7. I successfully able to do on simulator but when i did for device I got the following error:
    — webrtc has been sucessfully built
    — launching on device
    ERROR: stat: trunk/out_ios/Debug-iphoneos/AppRTCDemo.app: No such file or directory
    — launch complete

    Let me know if you have idea to resolve that issue.

    Reply
    • @manish

      Hi Manish,

      The makeall-iosdevice.sh script defines the output directory where the application will be placed, so double check that your file matches what I have above, especially this line:

      wrios && gclient runhooks && ninja -C out_ios/Debug-iphoneos AppRTCDemo

      If that all looks okay, then it sounds like there is some other error happening during the build phase, possibly related to code signing. Do you see any other error messages being printed out further back in the output log?

      Reply
  8. the gclient sync step always fails for me with various errors about http:// sites not being reachable. if i manually take each line that says “running” and replace http:// with https:// and take out non-interactive it will let me manually grab those particular checkouts. but it still dies with.

    “________ running ‘svn update /Users/kevinbradley/Developer/WebRTC/trunk –non-interactive –force –accept theirs-conflict –ignore-externals’ in ‘/Users/kevinbradley/Developer/WebRTC’
    Updating ‘trunk':
    At revision 5383.
    Error: 2> This url is unreachable: http://src.chromium.org/svn/trunk/src@238260

    without telling me a corresponding checkout line :( this seems to happen to me with every single svn project i try. mayb ei just need to update my svn build? any thoughts?

    Reply
    • @kevin

      Hi Kevin,

      I would definitely double check that you are not running a really old version of subversion, I’ve seen people get similar errors for that reason. Otherwise the only thing I could think to really check would be any firewall settings you might have that would prevent subversion from talking to the Internet?

      Reply
  9. i tried updating to a newer build of svn but still get similiar problems. was thinking maybe it was company network firewall issues (will have to check into that) but tried while remoted in to my computer at home as well with similar issues. its a shame the process doesnt appear to be a bit more transparent. i’d have no problem editing config files to change everything to https if i could, but i cant figure out where it fetches those lists from.

    Reply
  10. Hi Jason

    Thanks for your job.

    I followed the tutorial and i installed good but when i treat to execute ./makeall-iossim.sh it presents the next errors:

    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
    ~/rtc
    — webrtc has been sucessfully built
    — running webrtc appdemo
    ~/rtc/trunk ~/rtc
    iossim: ERROR: Simulator failed to start: “Simulator session timed out.” (DTiPhoneSimulatorErrorDomain:2)
    ~/rtc

    i reseted the content and settings of simulator but don’t fixed

    Can you help me please ?

    Reply
    • @Richard

      This is a bug in trunk/third_party/libyuv:
      http://code.google.com/p/libyuv/issues/detail?id=308

      Workaround (in trunk/third_party/libyuv):
      svn up -r972

      And then call makeall-iossim.sh with fetch disabled.

      Reply
      • @Matthias

        Thanks Matthias!

        Reply
      • @Matthias

        Hi Matthias

        Thanks

        but it continue to presenting error:
        Generating gyp files from GN…
        Updating projects from gyp files…
        Hook ‘/usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0′ took 24.28 secs
        ninja: Entering directory `out_sim/Debug’
        ninja: no work to do.
        ~/wrtc
        — webrtc has been sucessfully built
        — running webrtc appdemo
        ~/wrtc/trunk ~/wrtc
        iossim: ERROR: Simulator failed to start: “Simulator session timed out.” (DTiPhoneSimulatorErrorDomain:2)

        I have xcode 5.0.2 and simulator 7.0.3 running on macbook with mountain lion.

        please help me
        Thanks

        Reply
        • @Richard

          The issue I mentioned above is fixed now.

          From what I can tell, your issue seems to have to do with the iOS simulator, not with (lib)webrtc. Make sure it’s not running in the background somewhere (check the processes). Try to start it manually:
          $ ios-sim start
          If this works, you can try “Reset Content and Settings…” from the i”OS Simulator” menu.

          Otherwise, try googling this error message, there seems to be a lot of discussion going on..

          Reply
          • @Matthias

            Thanks

            It works on simulator, now I am executing app on the device.
            It shows error:

            _YUY2ToI422 in libyuv.a(libyuv.planar_functions.o)
            ld: symbol(s) not found for architecture armv7
            clang: error: linker command failed with exit code 1 (use -v to see invocation)
            ninja: build stopped: subcommand failed.

            Help please.

          • @Matthias

            @Richard: Maybe the workaround for the (now fixed) issue with libyuv I mentioned above is still active on your side? Try to enable “fetch” again in Jason’s script.

  11. sriram yarlagadda

    List of command to BUild the source for IOS device:

    1)export PATH=/Users/o2c_macmini_02/depot_tools:$PATH —–depot tools path

    export JAVA_HOME=`/usr/libexec/java_home`

    gclient config http://webrtc.googlecode.com/svn/trunk/

    echo “target_os = [‘mac’]” >> .gclient

    gclient sync

    sed -i “” ‘$d’ .gclient

    echo “target_os = [‘ios’, ‘mac’]” >> .gclient

    gclient sync

    export GYP_DEFINES=”build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1 enable_tracing=1″
    or
    export GYP_DEFINES=”build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1″

    export GYP_GENERATORS=”ninja”

    export GYP_DEFINES=”$GYP_DEFINES OS=ios target_arch=armv7″

    export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_arm”
    or
    export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_dev”

    export GYP_CROSSCOMPILE=1

    gclient runhooks

    cd trunk

    ninja -C out_dev/Debug-iphoneos AppRTCDemo

    ideviceinstaller -i trunk/out_dev/Debug-iphoneos/AppRTCDemo.app

    Reply
  12. i see some examples in these build scripts for getting things working on the mac end, i know that part is incomplete since there is no mac example in the talk/ folder, if one was to add a mac project in the same way as the iOS one in that folder how would they get things building via your scripts? what other modifications would need to be done?

    thanks

    Reply
  13. sriram yarlagadda

    export GYP_DEFINES=”$GYP_DEFINES OS=ios target_arch=armv7″ —->iso device
    export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_arm” —–> this out folder is for ios device
    (or)
    export GYP_DEFINES=”$GYP_DEFINES OS=ios target_arch=ia32″ —–>for simulator
    export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_sim” —-> out for simulator
    [or]
    export GYP_DEFINES=”$GYP_DEFINES OS=mac target_arch=x64″ —–> for mac
    export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_mac” —-> out for mac

    @kevin
    These are the three ways you can do.

    just change these commands based on your requirement.

    Reply
  14. thanks guys! i actually figured it out earlier today as well, there is another modification that is needed aside from the scripts (i guess i should’ve said what i already tried!)

    makeall-mac.sh

    function fetch() {
    echo “– fetching webrtc”
    gclient config http://webrtc.googlecode.com/svn/trunk/
    echo “target_os = [‘mac’]” >> .gclient
    gclient sync

    sed -i “” ‘$d’ .gclient
    echo “target_os = [‘ios’, ‘mac’]” >> .gclient
    gclient sync
    echo “– webrtc has been sucessfully fetched”

    }

    function wrbase() {
    export GYP_DEFINES=”build_with_libjinglth_chromium=0 libjingle_objc=1″
    export GYP_GENERATORS=”ninja”
    }

    function wrios() {
    wrbase
    export GYP_DEFINES=”$GYP_DEFINES OS=ios target_arch=armv7″
    export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_ios”
    export GYP_CROSSCOMPILE=1
    }

    function wrmac() {
    wrbase
    export GYP_DEFINES=”$GYP_DEFINES OS=mac target_arch=x64″
    export GYP_GENERATOR_FLAGS=”$GYP_GENERATOR_FLAGS output_dir=out_mac”
    }

    function buildmac() {
    echo “– building webrtc mac”
    pushd trunk
    wrmac && gclient runhooks && ninja -C out_mac/Debug AppRTCDemo
    popd
    echo “– webrtc has been sucessfully built”

    }

    function buildios() {
    echo “– building webrtc ios”
    pushd trunk
    wrios && gclient runhooks && ninja -C out_ios/Debug-iphoneos AppRTCDemo
    popd
    echo “– webrtc has been sucessfully built”
    }

    function launch() {
    echo “– launching on device”
    ideviceinstaller -i trunk/out_ios/Debug-iphoneos/AppRTCDemo.app
    echo “– launch complete”
    }

    function fail() {
    echo “*** webrtc build failed”
    exit 1
    }

    #fetch || fail
    #wrmac || fail
    buildmac || fail
    #launch || fail

    ** gyp file

    trunk/talk/libjingle_examples.gyp

    added

    [‘OS==”mac”‘, {
    ‘targets': [
    {
    ‘target_name': ‘AppRTCDemo’,
    ‘type': ‘executable’,
    ‘product_name': ‘AppRTCDemo’,
    ‘mac_bundle': 1,
    ‘mac_bundle_resources': [
    ‘examples/ios/AppRTCDemo/ios_channel.html’,
    ‘examples/ios/Icon.png’,
    ],
    ‘dependencies': [
    ‘libjingle.gyp:libjingle_peerconnection_objc’,
    ],
    ‘conditions': [
    [‘target_arch==”ia32″‘, {
    ‘dependencies’ : [
    ‘<(DEPTH)/testing/iossim/iossim.gyp:iossim#host',
    ],
    }],
    ],
    'sources': [
    'examples/ios/AppRTCDemo/APPRTCAppDelegate.h',
    'examples/ios/AppRTCDemo/APPRTCAppDelegate.m',
    'examples/ios/AppRTCDemo/AppRTCDemo-Prefix.pch',
    'examples/ios/AppRTCDemo/main.m',
    ],
    'xcode_settings': {
    'CLANG_ENABLE_OBJC_ARC': 'YES',
    'INFOPLIST_FILE': 'examples/mac/AppRTCDemo/Info.plist',
    'OTHER_LDFLAGS': [
    '-framework Foundation',
    '-framework Cocoa',
    ],
    },
    }, # target AppRTCDemo
    ], # targets
    }], # OS=="mac"

    hope that all comes through.

    now i just gotta figure out how to get it to talk with the webrtc stuff my company already has set up. thanks for the awesome tutorial

    Reply
  15. Hi jason,
    I do follow your instruction except this
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    To fix the build for multiple identities, we will need to modify 2 files. Open trunk/talk/libjingle_examples.gyp and change line 271 from this:

    1
    ‘key_id%': ‘<!(security find-identity -p codesigning -v | grep "iPhone Developer" | awk \'{print $2}\')',
    to this:

    1
    'key_id%': '<!(security find-identity -p codesigning -v | grep "iPhone Developer" | awk \'{print $2}\' | head

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    because I could not find them and after run "make all-iosdevice" I got this error

    — webrtc has been sucessfully built
    — launching on device
    Uploading AppRTCDemo.app package contents… DONE.
    Installing '(null)'
    Install – CreatingStagingDirectory (5%)
    Install – ExtractingPackage (15%)
    Install – InspectingPackage (20%)
    Install – TakingInstallLock (20%)
    Install – PreflightingApplication (30%)
    Install – VerifyingApplication (40%)
    Install – Error occured: ApplicationVerificationFailed
    — launch complete

    thanks

    Reply
  16. Hi, I am trying to follow the steps to download and build the webrtc library. After entering the commands

    gclient config http://webrtc.googlecode.com/svn/trunk
    gclient sync –force

    I can see stuffs downloading. But after a while I get an error on my terminal like this :

    Error: Command svn checkout http://src.chromium.org/svn/trunk/src/third_party/sqlite@249215 /my_working_dir/trunk/third_party/sqlite –revision 249215 –non-interactive –force –ignore-externals returned non-zero exit status 1 in /my_working_dir

    Can anyone help me with this error? I am on Mac OS X 10.9

    Reply
  17. siva gopalasetti

    Hi jason,

    Thanks for your job.
    I have successfully installed the application in both the simulator and device.

    But when i am giving the room number to the application it is not getting connected.

    showing the following message.

    onICEServers – add local stream.
    GAE onOpen – create offer.
    PC -createOffer.
    SDP onSuccess(SDP)- set local description.
    PC setLocalDescription.
    SDP onSuccsess() – possibly drain candidates
    GAE onError: 400:message:%22%22

    Thanks in advance.

    Reply
  18. Hi,
    I followed the above instruction to compile for ios simulator. getting the following error? with saying ‘webrtc has been sucessfully built’

    AssertionError: Multiple codesigning fingerprints for identity: iPhone Developer
    Error: Command /usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0 returned non-zero exit status 1 in /Users/saravanan
    Hook ‘/usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0′ took 33.98 secs
    ninja: Entering directory `out_sim/Debug’
    ninja: error: build.ninja:98: unexpected EOF
    subninja obj/third_party
    ^ near here
    ~
    — webrtc has been sucessfully built
    — running webrtc appdemo
    ~/trunk ~
    ./makeall-iossim.sh: line 44: ./out_sim/Debug/iossim: No such file or directory

    Reply
  19. Another good project for helping to compile and fix some minor issues related to iOS build
    https://github.com/wobbals/webrtc-ios

    Reply
  20. I want to build the libraries in ‘Release’ mode.

    What modifications do I need to do in the building script?

    Thanks

    Reply
    • @Sajid Hussain

      Hi Sajid,

      To build the libraries in release mode instead of debug mode, all you need to do is replace every instance of “out_ios/Debug-” with “out_ios/Release-” in my build scripts (makeall-iosdevice.sh or makeall-iossim.sh). The build environment will notice that change and use the appropriate optimization levels.

      Reply
  21. Andrey Moskvin

    Hi everybody!

    Great article, but I’ve encountered problems with building sources for iOS simulator.

    In file included from ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:11:
    /Users/andrey.moskvin/Development/Temp/trunk/third_party/llvm-build/Release+Asserts/bin/../lib/clang/3.5/include/tmmintrin.h:28:2: error: “SSSE3 instruction set not enabled”
    #error “SSSE3 instruction set not enabled”
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:47:3: error: use of undeclared identifier ‘__m128i’
    __m128i firstFilters, secondFilters, thirdFilters, forthFilters;
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:48:3: error: use of undeclared identifier ‘__m128i’
    __m128i srcRegFilt1, srcRegFilt2, srcRegFilt3, srcRegFilt4;
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:49:3: error: use of undeclared identifier ‘__m128i’
    __m128i addFilterReg64, filtersReg, srcReg, minReg;
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:53:3: error: use of undeclared identifier ‘addFilterReg64′
    addFilterReg64 =_mm_set1_epi32((int)0x0400040u);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:53:19: warning: implicit declaration of function ‘_mm_set1_epi32′ is invalid in C99 [-Wimplicit-function-declaration]
    addFilterReg64 =_mm_set1_epi32((int)0x0400040u);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:54:3: error: use of undeclared identifier ‘filtersReg’
    filtersReg = _mm_loadu_si128((__m128i *)filter);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:54:16: warning: implicit declaration of function ‘_mm_loadu_si128′ is invalid in C99 [-Wimplicit-function-declaration]
    filtersReg = _mm_loadu_si128((__m128i *)filter);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:54:33: error: use of undeclared identifier ‘__m128i’
    filtersReg = _mm_loadu_si128((__m128i *)filter);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:54:42: error: expected expression
    filtersReg = _mm_loadu_si128((__m128i *)filter);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:57:3: error: use of undeclared identifier ‘filtersReg’
    filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:57:15: warning: implicit declaration of function ‘_mm_packs_epi16′ is invalid in C99 [-Wimplicit-function-declaration]
    filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:57:31: error: use of undeclared identifier ‘filtersReg’
    filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:60:3: error: use of undeclared identifier ‘firstFilters’
    firstFilters = _mm_shufflelo_epi16(filtersReg, 0);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:60:18: warning: implicit declaration of function ‘_mm_shufflelo_epi16′ is invalid in C99 [-Wimplicit-function-declaration]
    firstFilters = _mm_shufflelo_epi16(filtersReg, 0);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:60:38: error: use of undeclared identifier ‘filtersReg’
    firstFilters = _mm_shufflelo_epi16(filtersReg, 0);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:62:3: error: use of undeclared identifier ‘secondFilters’
    secondFilters = _mm_shufflelo_epi16(filtersReg, 0xAAu);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:62:39: error: use of undeclared identifier ‘filtersReg’
    secondFilters = _mm_shufflelo_epi16(filtersReg, 0xAAu);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:64:3: error: use of undeclared identifier ‘firstFilters’
    firstFilters = _mm_shufflehi_epi16(firstFilters, 0x55u);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:64:18: warning: implicit declaration of function ‘_mm_shufflehi_epi16′ is invalid in C99 [-Wimplicit-function-declaration]
    firstFilters = _mm_shufflehi_epi16(firstFilters, 0x55u);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:64:38: error: use of undeclared identifier ‘firstFilters’
    firstFilters = _mm_shufflehi_epi16(firstFilters, 0x55u);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:66:3: error: use of undeclared identifier ‘secondFilters’
    secondFilters = _mm_shufflehi_epi16(secondFilters, 0xFFu);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:66:39: error: use of undeclared identifier ‘secondFilters’
    secondFilters = _mm_shufflehi_epi16(secondFilters, 0xFFu);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:69:3: error: use of undeclared identifier ‘thirdFilters’
    thirdFilters =_mm_load_si128((__m128i const *)filt1_4_h8);
    ^
    ../../third_party/libvpx/source/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_ssse3.c:69:17: warning: implicit declaration of function ‘_mm_load_si128′ is invalid in C99 [-Wimplicit-function-declaration]
    thirdFilters =_mm_load_si128((__m128i const *)filt1_4_h8);
    ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    6 warnings and 20 errors generated.

    And I have no idea how to fix this…
    My goal is to build universal static library… For this I need libraries built for both platforms (sim and iOS).

    Thanks in advance.

    Best regards,
    Andrey Moskvin

    Reply
  22. File “trunk/webrtc/build/gyp_webrtc”, line 80, in
    sys.exit(gyp.main(args))
    File “/Users/o2c_macmini_02/webrtc/websource/trunk/tools/gyp/pylib/gyp/__init__.py”, line 527, in main
    return gyp_main(args)
    File “/Users/o2c_macmini_02/webrtc/websource/trunk/tools/gyp/pylib/gyp/__init__.py”, line 512, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
    File “/Users/o2c_macmini_02/webrtc/websource/trunk/tools/gyp/pylib/gyp/generator/ninja.py”, line 2143, in GenerateOutput
    pool.map(CallGenerateOutputForConfig, arglists)
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py”, line 250, in map
    return self.map_async(func, iterable, chunksize).get()
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py”, line 554, in get
    raise self._value
    AssertionError: Multiple codesigning fingerprints for identity: iPhone Developer
    Error: Command /usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0 returned non-zero exit status 1 in /Users/o2c_macmini_02/webrtc/websource
    Hook ‘/usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0′ took 11.38 secs

    @ I am getting this error. please help me

    Reply
  23. SRIRAM YARLAGADDA

    Hi All

    Present webrtc trunk is not working. And not geting build.
    please check the and let me know. And ninja -c out/Debug and ninja -c out/Debug All is working. But AppRTCDemo.app file is not geting generating. please tell me solution for that. And also update the Blog.

    Regards,
    sriram,
    +91-9003150655

    Reply
  24. They fixed the problem with the build. But now de app crashed after connecting room.

    Reply
  25. Hi Jason,

    Thanks for the great blog.
    I am facing an issue can you please help me out. I am trying to build this on a Mas OS X but I am getting following error when I run the ‘gclient sync –force` command :

    7> /Users/abc/Desktop/VideoChat/depot_tools/third_party/boto/pyami/config.py:75: UserWarning: Unable to load AWS_CREDENTIAL_FILE ()
    warnings.warn(‘Unable to load AWS_CREDENTIAL_FILE (%s)’ % full_path)
    Failure: ‘NoneType’ object is not callable.
    Error: Command download_from_google_storage –directory –recursive –num_threads=10 –no_auth –bucket chromium-webrtc-resources trunk/resources returned non-zero exit status 1 in /Users/abc/Desktop/VideoChat

    The similar error was posted here but the solution is does not work for me :
    https://code.google.com/p/webrtc/issues/detail?id=2632

    Someone else also faced same error on different issue but no solution was found there:
    https://groups.google.com/forum/#!topic/discuss-webrtc/7zLULtPsHwE

    Any help is much appreciated.

    Best,
    Shivang

    Reply
  26. Okay previous error got solved just by reinstalling the depot_tools but now i am facing another issue which i think is same as what @saravanan is facing :

    AssertionError: Multiple codesigning fingerprints for identity: iPhone Developer
    Error: Command /usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0 returned non-zero exit status 1 in /Users/abc/Desktop/webrtc
    Hook ‘/usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0′ took 22.09 secs
    ninja: Entering directory `out_sim/Debug’
    ninja: error: build.ninja:98: unexpected EOF
    subninja obj/third_party
    ^ near here
    ~/Desktop/webrtc
    — webrtc has been sucessfully built
    — running webrtc appdemo
    ~/Desktop/webrtc/trunk ~/Desktop/webrtc
    ./makeall-iossim.sh: line 44: ./out_sim/Debug/iossim: No such file or directory
    ~/Desktop/webrtc

    Reply
    • @Shivang

      hey @Shivang,
      Did you get solution for this issue?

      Reply
      • @saravanan

        @saravanan
        yes i did solve the problem:

        In file : trunk/tools/gyp/pylib/gyp/xcode_emulation.py and at lines 832-833 comment the following line :
        #assert identity not in cache or fingerprint == cache[identity], (
        #”Multiple codesigning fingerprints for identity: %s” % identity)

        Reply
  27. hi,
    I’m getting the following error when i try to compile it for simulator/mac
    ‘/makeall-iossim.sh: line 44: ./out_sim/Debug/iossim: No such file or directory’.
    is that dir should be created manually? I’m strucking here for a long time still no lucky, please reply to this thread asap.

    ./makeall-iossim.sh
    — fetching webrtc
    Error: 1> This url is unreachable: http://webrtc.googlecode.com/svn/trunk
    Error: 1> This url is unreachable: http://webrtc.googlecode.com/svn/trunk
    — webrtc has been sucessfully fetched
    — building webrtc
    ~/mywebrtc/trunk ~/mywebrtc
    ninja: Entering directory `out_sim/Debug’
    ninja: fatal: chdir to ‘out_sim/Debug’ – No such file or directory
    ~/mywebrtc
    — webrtc has been sucessfully built
    — running webrtc appdemo
    ~/mywebrtc/trunk ~/mywebrtc
    ./makeall-iossim.sh: line 44: ./out_sim/Debug/iossim: No such file or directory
    ~/mywebrtc

    Reply
  28. I followed all the steps mentioned but I am still not able to build this project. I am facing application verification failed error (I have all the valid certificates and provision profiles).

    I am getting the following error while running on iOS device:

    Uploading AppRTCDemo.app package contents… DONE.
    Installing ‘(null)’
    Install – CreatingStagingDirectory (5%)
    Install – ExtractingPackage (15%)
    Install – InspectingPackage (20%)
    Install – TakingInstallLock (20%)
    Install – PreflightingApplication (30%)
    Install – InstallingEmbeddedProfile (30%)
    Install – VerifyingApplication (40%)
    Install – Error occured: ApplicationVerificationFailed
    — launch complete

    I have even tried building the files given on https://github.com/gandg/webrtc-ios but it is also not working properly.

    Can anyone suggest how I can run webRTC on iOS device ?

    Reply
    • @Shivang

      I’m also facing the same issue now…@shivang let me if you get any idea

      Reply
    • @Shivang

      hey @shivang, this links has compiled libraries that works for me. https://github.com/gandg/webrtc-ios. Just pull this code then open webrtc-ios/ios-example/AppRTCDemo.xcodeproj

      Reply
      • @saravanan

        Hey saravanan,

        Thanks for replying. I have tried this link/xcode project but I am not able to run it.

        When I ran it for the first time:
        – 1 frame of video appeared
        – no audio was received on iOS side (I was able to get some audio on broweser but with lag).

        But second time the app crashed with following error:
        ‘Connection with server failed, error=61
        2014-04-08 14:25:57.180 AppRTCDemo[1476:7207] PCO onICECandidate. ‘

        Can you please tell me how you build and ran it ?

        Reply
        • @Shivang

          @Shivang
          Of course its crashing sometime. iOS webrtc build is not yet stable, I did only one changes in that source. Just Open the following file

          APPRTCAppClient.m => line no : 334
          NSString *url = [server objectForKey:@”url”]; => change the key ‘url’ to ‘urls’

          Reply
          • @saravanan

            Are you able to chat even for some time?

            What output exactly are you getting because even we have made the change you have mentioned but still we can only see a red screen.

  29. sure, are you using iphone 5? wifi/3g?

    Reply
    • @saravanan

      @shivang,
      Make sure you have good internet connection before test this build, i tried on wifi, even for me first 2 times didnt work and crashed as well. I tried again it worked. After red screen it may take some time to connect the call (its upto internet speed) so just wait for some seconds may be 30 – 40 seconds.

      Reply
  30. Hi Jason,

    Great tutorial! Thanks!

    Even I am getting a crash on app start. I even tried the fix mentioned in https://gerrit.chromium.org/gerrit/#/c/69342/4/vp8/encoder/pickinter.c,unified

    Any ideas?

    Reply
  31. He guys, trying to run the application, but have an error

    ________ running ‘download_from_google_storage –directory –recursive –num_threads=10 –no_auth –bucket chromium-webrtc-resources trunk/resources’ in ‘/Users/yuriylapytko/Documents/ios’
    /Users/yuriylapytko/Documents/ios/depot_tools/third_party/boto/pyami/config.py:75: UserWarning: Unable to load AWS_CREDENTIAL_FILE ()
    warnings.warn(‘Unable to load AWS_CREDENTIAL_FILE (%s)’ % full_path)
    Failure: ‘NoneType’ object is not callable.

    Tried everything you wrote, nothing changes.
    https://github.com/gandg/webrtc-ios – i see just red screen with errors
    It drives me mad.
    Has somebody run it? Does somebody have working project?
    Can you send me xcode project? Thanks.

    Reply
  32. Hi,

    Great tutorial! Thanks!

    I’m getting the following error when i try to compile it on iOS device:

    cannot find mobile provisioning for com.google.AppRTCDemo
    — webrtc has been sucessfully built
    — launching on device
    ERROR: stat: trunk/out_ios/Debug-iphoneos/AppRTCDemo.app: No such file or directory
    — launch complete

    Any idea?

    Reply
    • Shane Newberg
      @Jame

      Getting same error, not sure where to go next.

      Reply
      • Shane Newberg
        @Shane Newberg

        @ Jane and anyone else having this issue.
        1) Before starting the iOS project, create a new iOS App ID in the Apple Development portal with your own account and name for the ID. You will not be able to use com.google..AppRTCDemo for the id, so suggest changing com.google to your own company.
        2) Once the project is trying to build with the instructions on this page, then you can edit the trunk/talk/examples/ios/AppRTCDemo/Info.plist file with the correct app ID you created in step 1. Just search for com.google.AppRTCDemo for what to replace.

        Reply
  33. Hello all, we are building a webrtc app and need help. Please contact us if you can help us, 3-0-5-4 6 8-49-96
    thanks

    Reply
  34. this looks awesome. i just tried to install but gclient sync fails with…

    “Updating projects from gyp files…
    Traceback (most recent call last):
    File “./build/mac/find_sdk.py”, line 89, in
    print main()
    File “./build/mac/find_sdk.py”, line 57, in main
    sdks = [re.findall(‘^MacOSX(10\.\d+)\.sdk$’, s) for s in os.listdir(sdk_dir)]
    OSError: [Errno 2] No such file or directory: ‘/Library/Developer/CommandLineTools/SDKs’
    gyp: Call to ‘python ./build/mac/find_sdk.py 10.6′ returned exit status 1.
    Error: Command /usr/bin/python trunk/webrtc/build/gyp_webrtc -Dextra_gyp_flag=0 returned non-zero exit status 1 in /Users…”

    i have command line tools in os mavericks xcode 5.1 but they aren’t in that dir…. maybe that’s the problem? any ideas?

    Reply
    • @marcus

      Hi Marcus, were you able to figure this out? I just built the latest code (jun 6) with XCode 5.1.1 and Mavericks and didn’t run into this problem.

      Reply
  35. Hey this is a great article and its helped me plenty so far.

    However I am having some issues. So far the simulated version (I followed the instructions and used the Terminal) has given me better results than example version built in xcode (Downloaded the project and run on an iphone 4s).
    Currently I have only managed to get a video connection once and it died after a short time, was extremely bad quality and movement was jerky.

    The simulated version worked the few times I tested it, while I can never get the iphone version working.

    Any advice?

    Thanks

    Wayne

    Reply
    • @Wayne

      Okay I am an idiot. I was trying to test with Firefox. It did work once in that randomly though.

      Got it working with Chrome, insane delay on voice. Also Iphone picture does update its transmissions? Aka the picture in the browser stops updating.
      Do you feel this could be due to the phone? any suggestions? thanks

      Reply
      • @Wayne

        Sorry for triple posting, but a miracle has occured. A friend had a 4s which he let me test with and I was extremely impressed at how well it performed compared to just the 4.

        Thanks to anyone who took the time to read my responses.

        ps. Feel free to delete my posts moderator.

        Reply
  36. In file included from ../../webrtc/common_audio/fir_filter_neon.cc:13:
    /Users/o2c_macmini_02/15-05-2014/webrtc/trunk/third_party/llvm-build/Release+Asserts/bin/../lib/clang/3.5.0/include/arm_neon.h:28:2: error: “NEON support not enabled”
    #error “NEON support not enabled”

    Reply
  37. This is a super useful article, especially the make scripts – huge time saver. Now that the current HEAD supports both audio and video on iOS it might be worthwhile to update the article to not reference https://github.com/gandg/webrtc-ios – it’s still a great self-contained project but it is built against a pretty far-back revision of the WebRTC libraries; just getting that branch to build is somewhat tough.
    Also, one suggestion/update wrt correcting code-signing errors for people with multiple “iPhone Developer” identities – it seems to me the cleaner solution is to choose a particular identity/signing-profile by tweaking the trunk/build/common.gypi build environment, e.g. replacing the lines around 4720

    # iOS SDK wants everything for device signed
    ‘CODE_SIGN_IDENTITY[sdk=iphoneos*]': ‘iPhone Developer’

    with a specific one, like

    # iOS SDK wants everything for device signed
    ‘CODE_SIGN_IDENTITY[sdk=iphoneos*]': ‘iPhone Developer: Johnny Appleseed [P99CSHHA79]’

    Reply
  38. Hi again, curious if anyone can educate me.

    I am having trouble building the video and jingle libs myself.
    The instructions found here https://github.com/gandg/webrtc-ios – scroll down to the section stating how to build them.
    Once my files are located in the …/trunk/talk/app/webrtc/objc the instructions say “Build the AppRTCDemo target: wrios && gclient runhooks && ninja -C out_ios/Debug AppRTCDemo”.
    I am sure I am just being stupid here, but I am not sure what is meant by this.
    The name and the fact it states target suggests that I should build with xcode, but then where/what do I do with the following line wrios && gclient runhooks && ninja -C out_ios/Debug AppRTCDemo.
    I have seen this line within the two scripts mentioned in the tutorial?

    I appreciate any help that can be provided.

    Reply
    • @Wayne

      Okay I am just a dummy, I saw Jason’s comment about building the libraries with the command prompts then adding them into the xcode project.
      However despite my removing of the IOKIT lines, im still getting complaints.
      At least now I know how to build them, ill look into it some more.

      Reply
  39. I was build the webrtc for ios. Open the all.xcodeproj, then build the target of AppRTCDemo. And i get a error about “common_audio_sse2″, the detail look like this:
    clang: error: argument unused during compilation: ‘-msse2′

    The all.xcodeproj can’t work well? Are you able to compile and run it?

    Reply
  40. Hello all. Many thanks for this great article!

    Looks like I am building something other than iOS while following these steps. Here is a cut of my log with first error encounter:
    — webrtc has been sucessfully fetched
    — building webrtc ios
    ~/Projects/WebRTC/trunk ~/Projects/WebRTC
    gclient(505) MergeWithOsDeps:Conflicting dependencies for third_party/nss: [(‘mac’, ), (‘ios’, )]. (target_os=(‘mac’, ‘ios’))
    gclient(505) MergeWithOsDeps:Conflicting dependencies for testing/iossim/third_party/class-dump: [(‘mac’, ‘http://src.chromium.org/svn/trunk/deps/third_party/class-dump@199203′), (‘ios’, )]. (target_os=(‘mac’, ‘ios’))

    ,later the following warning will skyrocket into log:
    “Warning: Ignoring unsupported variable “$(ARCHS_STANDARD_INCLUDING_64_BIT)”.

    Turns out it build for Mac OS or some alike of. I feel it should be configured somehow and somewhere close within scripts but I cannot figure out where exactly.
    Would greatly appreciate a kind sir who could enlight me with some hints here. Thank you.

    Reply
  41. hi,
    many thanks for your guide,I have installed it in my iphone.but the video is very slow , that is real time video streaming transport very slow? and is it normal or is not normal?

    Reply
    • @sun longhai

      Hi Sun,

      I’ve heard it is very slow on the iPhone 4. I have tested with the iPhone 5 and while it is much better, it still has a lot of room for improvement.

      Reply
  42. Saransh Mohapatra

    I have read in your replies to comments above stating that you won’t advice anyone using webrtc on iOS for a production app. Can you please state the exact reasons you are saying so?

    Reply
    • @Saransh Mohapatra

      That was several months ago, when the connection was still very unreliable. The latest releases have seemed MUCH more stable, although I have not fully qualified them myself.

      Reply
  43. Ryan Harvardson

    Hi,
    I loved your article and I am sharing it with anyone who is interested in web rtc. Is there a way to set your own stun server in the config for the example app? Have you happened upon this? I am just wondering because I am working on an app that requires me to host my own stun server.
    I really appreciate your article and all your efforts!!
    Thank you,
    Ryan

    Reply
    • @Ryan Harvardson

      Hi Ryan, thanks!

      You sure can. You will need to customize the signaling layer code in the example application, located here:

      trunk/talk/examples/objc/

      The example application uses the public Google STUN server stun.l.google.com as directed by apprtc.appspot.com. You will need to customize the code here for however your STUN server is configured, presumably by avoiding talking to apprtc.appspot.com and using your own signaling servers instead.

      Reply
  44. Hi,

    I am unable to build webrtc on Mac and getting the following error when I run >gclient sync –force

    /Users/shaj/webrtc-final/depot_tools/third_party/boto/pyami/config.py:75: UserWarning: Unable to load AWS_CREDENTIAL_FILE ()
    warnings.warn(‘Unable to load AWS_CREDENTIAL_FILE (%s)’ % full_path)
    Failure: [Errno 1] _ssl.c:499: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed.

    I appreciate any suggestions on this.

    Reply
    • @chandra

      Hi Chandra,

      Make sure you’re using the latest version of the chromium depot tools, others have said this problem occurs with older versions. If you still see this problem, try using one of the specific release versions of WebRTC instead of the latest development branch by adding a parameter to the sync call:

      gclient sync –force -r 6604

      I’ve been using that specific release without any issues.

      Reply
  45. Hi Jason,

    Do you know how to use the build-system (GYP+Ninja) to build WebRTC using LibC++ ?

    Thanks,
    Fernando.

    Reply
  46. Very useful info, thanks!

    I have a working iOS app using WebRTC, but it sometimes fails with the error GAE onError 400. After investigation, this error is coming from the GAE channel API (Javascript code running in ios_channel.html). Error 400 is an invalid SID, and in my case it is happening after the channel has been successfully opened. I guess that AppRTC is prematurely closing the channel?

    Is anyone else having this issue?

    Many thanks!

    Reply
  47. Hi Jason,

    Syncing projects: 100% (52/52), done.

    ________ running ‘/usr/bin/python trunk/build/cp.py trunk/../chromium_gn/.gn trunk’ in ‘/Users/sathish/iOSWebRTC’

    ________ running ‘/usr/bin/python trunk/build/cp.py trunk/third_party/build_gn/BUILD.gn trunk/third_party’ in ‘/Users/sathish/iOSWebRTC’

    ________ running ‘download_from_google_storage –no_resume –platform=win32 –no_auth –bucket chromium-gn -s trunk/buildtools/win/gn.exe.sha1′ in ‘/Users/sathish/iOSWebRTC’
    Traceback (most recent call last):
    File “./depot_tools/gclient.py”, line 2064, in
    sys.exit(Main(sys.argv[1:]))
    File “./depot_tools/gclient.py”, line 2052, in Main
    return dispatcher.execute(OptionParser(), argv)
    File “/Users/sathish/iOSWebRTC/depot_tools/subcommand.py”, line 245, in execute
    return command(parser, args[1:])
    File “./depot_tools/gclient.py”, line 1830, in CMDsync
    ret = client.RunOnDeps(‘update’, args)
    File “./depot_tools/gclient.py”, line 1350, in RunOnDeps
    self.RunHooksRecursively(self._options)
    File “./depot_tools/gclient.py”, line 895, in RunHooksRecursively
    hook, cwd=self.root.root_dir, always=True)
    File “/Users/sathish/iOSWebRTC/depot_tools/gclient_utils.py”, line 281, in CheckCallAndFilterAndHeader
    return CheckCallAndFilter(args, **kwargs)
    File “/Users/sathish/iOSWebRTC/depot_tools/gclient_utils.py”, line 476, in CheckCallAndFilter
    **kwargs)
    File “/Users/sathish/iOSWebRTC/depot_tools/subprocess2.py”, line 253, in __init__
    % (str(e), kwargs.get(‘cwd’), args[0]))
    OSError: Execution failed with error: [Errno 2] No such file or directory.
    Check that /Users/sathish/iOSWebRTC or download_from_google_storage exist and have execution permission.

    I dont know why this is happening. Please help me out..

    Reply
  48. What do you do for a server? I’ve got the code running on iOS; but I want to connect to my own server, ideally with an MCU, and some other video manipulation. Would the iOS code work against, for example licode? Or is there a specific server we need to download to use it with?

    it’s very impressive; and I want to use it on a project I’m on; but I need to move beyond pointing at the sample URL provided with the git repo, and have no idea what to use for that.

    Reply
  49. I followed the directions above, but there is no trunk/out_ios directory. Is this created automatically somewhere? The makeall-iosdevice.sh script tells ninja to use that directory, but it doesn’t exist?

    ./makeall-iosdevice.sh
    — building webrtc ios
    ninja: Entering directory `out_ios/Debug-iphoneos’
    ninja: fatal: chdir to ‘out_ios/Debug-iphoneos’ – No such file or directory
    — webrtc has been sucessfully built
    — launching on device
    ERROR: stat: trunk/out_ios/Debug-iphoneos/AppRTCDemo.app: No such file or directory
    — launch complete

    Reply
    • @Jee

      It sounds like something failed further back in the build process. Take a look closely through the build log and you will most likely see it complaining about something there. That directory gets created only after everything else succeeds.

      Reply
      • @jason

        I figured out the problem:

        I had to run:
        trunk/setup-links.py –force
        gclient sync
        gclient runhooks

        Then I could run your script.

        That is the only way it would work for me.

        Reply
  50. Hey,Jason !
    Just one word for this blog its Fantastic.I have been already wasted my 1 day in this topic.But still can’t get any idea.How to do it.
    Today i just followed your direction.It seems it will work for me too..
    I just have following all the direction but i stuck at this error can anyone let me know..what i m missing..

    ________ running ‘/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u trunk/sync_chromium.py –target-revision 6455c698e51af65f57a8fe83547296218a5a7251′ in ‘/Users/puspraj/Desktop/project/voice’
    Running “gclient sync –force –revision src@6455c698e51af65f57a8fe83547296218a5a7251 –no-history –deps=mac” in /Users/puspraj/Desktop/project/voice/trunk/chromium
    [0:01:00] Still working on:
    [0:01:00] src
    [0:01:10] Still working on:
    [0:01:10] src
    [0:01:20] Still working on:
    [0:01:20] src
    it continuos……..printing same.

    Thanks & Regards
    Arpan

    Reply
    • @Arpan

      Believe it or not, it is actually doing something back there. It’s downloading gigantic code repositories, so I would just let it run. I recently grabbed the code for Android and it took almost 4 hours to download the several-gig source.

      Reply
  51. Hi, please can you help with this?

    ios simulator works fine but when I try to run on device a i get this error message:

    roberts-mbp:WebRTC robertsabol$ ./makeall-iosdevice.sh
    — building webrtc ios
    ~/Development/Work/WebRTC/src ~/Development/Work/WebRTC
    .gclient file in parent directory /Users/robos23/Development/Work/WebRTC might not be the file you want to use
    Error: No solution specified
    ~/Development/Work/WebRTC
    — webrtc has been sucessfully built
    — launching on device
    ERROR: stat: src/out_ios/Debug-iphoneos/AppRTCDemo.app: No such file or directory
    — launch complete

    Thanks

    Reply
    • @robos23

      I just updated the post with a brand new build script that should make things easier. Give that a try and see if it fixes your problem.

      Reply
      • @jason

        Thank you for your very quick reply, but I am still have a problem with running on device :-/

        Installing ‘(null)’
        Install – CreatingStagingDirectory (5%)
        Install – ExtractingPackage (15%)
        Install – InspectingPackage (20%)
        Install – TakingInstallLock (20%)
        Install – PreflightingApplication (30%)
        Install – VerifyingApplication (40%)
        Install – Error occured: ApplicationVerificationFailed
        – launch complete

        Reply
        • @robos23

          That sounds like it might be a code signing issue to me. Are you sure that you have a valid provisioning profile installed for this device & app ID? Take a close look at the “Curveball: Codesigning” section in the article.

          Reply
  52. Thanks for the awesome guide and the recent update. I think you have a typo in “Building and running directly on an iOS device”: i believe you meant “./build_apprtc.sh build_iosdevice” not “./build_apprtc.sh build_iossim” as you wrote down.

    Reply
  53. Cannot rebase: You have unstaged changes.
    Please commit or stash them.
    —————————————-
    Error: 1> Unrecognized error, please merge or rebase manually.
    1> cd /Volumes/MATT/webrtc-ios/src/chromium/src && git rebase –onto 28d1981264903b186f5e9275c8f71d7943ccad7d refs/remotes/origin/master
    Error: Command /usr/bin/python -u src/sync_chromium.py –target-revision 28d1981264903b186f5e9275c8f71d7943ccad7d returned non-zero exit status 1 in /Volumes/MATT/webrtc-ios
    Hook ‘/usr/bin/python -u src/sync_chromium.py –target-revision 28d1981264903b186f5e9275c8f71d7943ccad7d’ took 852.54 secs
    ninja: Entering directory `out_ios/Release-iphonesimulator’
    ninja: fatal: chdir to ‘out_ios/Release-iphonesimulator’ – No such file or directory
    /Volumes/MATT/webrtc-ios

    Reply
  54. when I use gclient sync –force -r 6604. there are also errors.

    Checked out revision 206024.
    Syncing projects: 59% (32/54) src/third_party/libc++/trunk

    src/third_party/icu (ERROR)
    —————————————-
    [0:06:02] Started.
    —————————————-
    Error: Command svn update http://src.chromium.org/svn/trunk/deps/third_party/icu46@262949 /Volumes/MATT/webrtc-ios/src/third_party/icu –revision 262949 –non-interactive –force –ignore-externals returned non-zero exit status 1 in /Volumes/MATT/webrtc-ios

    Reply
    • @Matt

      Hi Matt,

      I’m not exactly sure what’s going on there but it seems like something got hosed up pretty bad. I would try deleting your working directory and trying to download the code from scratch again. Also, revision 6604 is super old and definitely won’t build with the new instructions on this post. I updated the description to reference the revision that is working for me with (7538). Sorry, I missed updating that last time around.

      Reply
  55. You’re a gentleman and a scholar! Finally a post that works straight out of the bag. Thank you for your contribution and great work.

    Any tutorials or tricks/settings to build the same for Android?

    Cheers.
    Rich

    Reply
    • @Rich Storm

      Haha, thanks! Putting together an Android post is on my list, hopefully I can get to it in the next week or so. The main thing to know there is that you can not build Android WebRTC on Mac. You need to use either a Linux machine or run Ubuntu in a virtual machine like VMWare Fusion.

      Reply
  56. Hi, Jason,

    Thanks for your help. I have built it successfully and get the libWEBRTC.a.
    I have another question, if there is a example or demo which is based on the libWebRTC.a to reference?
    Thanks.

    Best regards
    Matt

    Reply
  57. Thanks a lot! This has definitely saved me a lot of time. It is by far the most complete and comprehensive guide that I was able to find while trying to get this to work!

    Reply
  58. Hi,

    Great article and many thanks for it!

    Can you please update your build script to support armv7, armv7s and armv64. As I can see (https://groups.google.com/forum/#!msg/discuss-webrtc/6WYcP-qiigE/2S5qABg1sL4J) armv64 is now supported for all libraries inside webRTC code.

    Reply
  59. Thanks a lot! Great post.

    Reply
  60. Hi, Jason,
    I have two problems. Do you have some ideas?
    The one is the iOS demo can call the demo in website.(website create the room, then iOS side join the room). However, if the iOS side create the room, when the website join in, the iOS app will have error and closed.
    “Stats: Failed to set session description: Failed to set remote offer sdp: Called in wrong state: STATE_SENTINITIATE ”
    above information appears in the website.
    When android side call the ios side, there is the same problem.

    The other question is, there are two demos in android platform. one is AppRTCdemo, and the other is WebRTCdemo.

    I found it in http://www.webrtc.org/reference/getting-started.
    WebRTCDemo (Android application using media engines)
    Target name WebRTCDemo. This app does not use WebRTC native APIs. It can send and receive media streams if manually connected to another WebRTCDemo that is directly accessible (e.g. firewalls might prevent you from establishing a connection). Further it allows setting, enabling and disabling audio and video processing functionality (e.g. echo cancellation, NACK, audio codec and video codec).

    I was wondering if there is a same WebRTCdemo in iOS platform.

    Thanks.

    Best regards
    Matt

    Reply
    • @MATT

      Hi Matt,

      The demo app is intended to be just that, a very simple demonstration of the technology working. It does not support any of the features you have mentioned, you would have to design that yourself. I am not aware of any other public demos that do include those features, but it would not surprise me if they are out there somewhere.

      Reply
  61. Hello there, really nice work, it helped me a lot on my own project.

    I got an issue. The application on ios simulator was working “perfectly” last month. I tried it today again and after entering the room into the ios simulator, the app crashes and writes me:

    MBP-de-Bibi:WebRTCFirstTest Victory$ ./build_apprtc.sh run_simulator
    — running webrtc appdemo on iOS simulator
    2014-12-29 09:59:39.351 AppRTCDemo[32279:1684741] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘data parameter is nil’
    *** First throw call stack:
    (
    0 CoreFoundation 0x02e6e946 __exceptionPreprocess + 182
    1 libobjc.A.dylib 0x03241a97 objc_exception_throw + 44
    2 CoreFoundation 0x02e6e86d +[NSException raise:format:] + 141
    3 Foundation 0x008b6ec6 +[NSJSONSerialization JSONObjectWithData:options:error:] + 67
    4 AppRTCDemo 0x0003856d AppRTCDemo + 9581
    5 AppRTCDemo 0x00038127 AppRTCDemo + 8487
    6 AppRTCDemo 0x00037b40 AppRTCDemo + 6976
    7 AppRTCDemo 0x000399d4 AppRTCDemo + 14804
    8 libdispatch.dylib 0x03fd9a2a _dispatch_call_block_and_release + 15
    9 libdispatch.dylib 0x03ff603f _dispatch_client_callout + 14
    10 libdispatch.dylib 0x03fdf764 _dispatch_main_queue_callback_4CF + 470
    11 CoreFoundation 0x02dc895e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
    12 CoreFoundation 0x02d87760 __CFRunLoopRun + 2256
    13 CoreFoundation 0x02d86bcb CFRunLoopRunSpecific + 443
    14 CoreFoundation 0x02d869fb CFRunLoopRunInMode + 123
    15 GraphicsServices 0x04e6724f GSEventRunModal + 192
    16 GraphicsServices 0x04e6708c GSEventRun + 104
    17 UIKit 0x00cec8b6 UIApplicationMain + 1526
    18 AppRTCDemo 0x0003eec9 AppRTCDemo + 36553
    19 libdyld.dylib 0x0401cac9 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    iossim: WARNING: Console message: Dec 29 09:59:40 MBP-de-Bibi com.apple.CoreSimulator.SimDevice.717FC1A6-4251-45A7-A442-AC647CB01CB7.launchd_sim[32241] (UIKitApplication:com.google.AppRTCDemo[0x5631][32279]): Service exited due to signal: Abort trap: 6
    iossim: ERROR: Simulated app crashed or exited with non-zero status

    Thank you very much for the help :’)

    Reply
    • @Bryan

      Hi Bryan,

      The server side has changed quite a bit recently, the google team has switched the web socket implementation of the demo app around. You may need to grab the latest code and rebuild the demo app.

      Reply
  62. Great tutorial. Thanks!

    It’s seem the terminal stuck by the “gclient sync –force” command but it shows “Syncing projects: 100% (3/3), done.”:

    Syncing projects: 33% ( 1/ 3) src

    Syncing projects: 100% (3/3), done.

    [1:01:31] Still working on:
    [1:01:31] src
    [1:01:41] Still working on:
    [1:01:41] src
    [1:01:51] Still working on:
    [1:01:51] src
    [1:02:01] Still working on:
    [1:02:01] src

    How can i resolve it or just waiting? Thanks

    Reply
  63. Many thanks Jason for your effort in writing this up (and answering endless questions). Your tutorial made it much easier to get started in such a deep framework.

    Reply
  64. Hi Jason,

    I have been searching for a few days to find a simple tutorial showing how I might add a data channel to the AppRTCDemo app but can’t find anything. I took a stab at adding the following code after the ICE state changed to RTCICEConnectionConnected:

    RTCDataChannelInit *dataChannelInit= [[RTCDataChannelInit alloc]init];
    dataChannelInit.isOrdered=YES;
    dataChannelInit.isNegotiated=NO;
    self.dataChannel= [self.peerConnection createDataChannelWithLabel:@”myDataChannel” config:dataChannelInit];

    This resulted in the following errors:

    Error(webrtcsession.cc:1133): ConnectDataChannel called when data_channel_ is NULL.
    Error(webrtcsession.cc:1154): AddDataChannelStreams called when data_channel_ is NULL.

    Any hints to point me in the right direction would be greatly appreciated. Thanks!

    Reply
  65. Hey,Jason !
    Just one word for this blog its Fantastic.I have been already wasted my 1 day in this topic.But still can’t get any idea.How to do it.
    Today i just followed your direction.It seems it will work for me too..
    I just have following all the direction but i stuck at this error can anyone let me know..what i m missing..

    run “./build_apprtc.sh build_iossim”
    ./build_apprtc.sh build_iossim
    — building WebRTC for the iOS simulator
    ./build_apprtc.sh: line 7: pushd: src: No such file or directory
    .gclient file in parent directory /Users/a360/Desktop/webrtc might not be the file you want to use
    Error: No solution specified
    ninja: Entering directory `out_ios/Release-iphonesimulator’
    ninja: fatal: chdir to ‘out_ios/Release-iphonesimulator’ – No such file or directory
    ./build_apprtc.sh: line 10: popd: directory stack empty

    Reply
    • @Hi Jason

      This seems to be the problem:

      ./build_apprtc.sh: line 7: pushd: src: No such file or directory

      The WebRTC source code should have been downloaded into the ‘src’ directory, which appears to be missing for you. Make sure that step 3 under the “Get the code base” section above was successful for you before attempting to build anything.

      Reply
  66. or
    ./build_apprtc.sh build_iossim
    — building WebRTC for the iOS simulator
    ~/Desktop/webrtc/src ~/Desktop/webrtc
    .gclient file in parent directory /Users/a360/Desktop/webrtc might not be the file you want to use
    Error: No solution specified
    ninja: Entering directory `out_ios/Release-iphonesimulator’
    ninja: error: loading ‘build.ninja': No such file or directory
    ~/Desktop/webrtc

    Reply
  67. Wonderful article Thank you a lot !!! I really appreciate your effort .

    Reply
  68. Awesome guide. Thanks a lot!

    (Now that the issues with arm64 and arm7s have been resolved, the paragraph on arm64 is outdated and can be removed.)

    Reply
  69. Thanks so much for this, it saved me a ton of time yesterday. Particularly the build script. I’m working on a version for building for 64-bit devices, which can be found here: https://gist.github.com/justinmakaila/0d3417cd0231c85133a0

    Feel free to offer up any advice, that goes for anyone!

    Reply
  70. Hi Jason
    Its fantastic to follow your direction.
    When I run ./build_apprtc.sh run_simulator Just as you said The test application has not been the most reliable thing I tried numerous times and all failed. This is what I get from command line
    2015-03-11 10:01:14.820 AppRTCDemo[8842:56962] Client connecting.
    2015-03-11 10:01:14.824 AppRTCDemo[8842:56962] Registering with room server.
    2015-03-11 10:01:19.186 AppRTCDemo[8842:56962] Error parsing JSON: The operation couldn’t be completed. (Cocoa error 3840.)
    2015-03-11 10:01:19.186 AppRTCDemo[8842:56962] Failed to register with room server. Result:0
    2015-03-11 10:01:19.186 AppRTCDemo[8842:56962] Client disconnected.
    Is is normal ? Could I continue my step? if not what should I do?

    Reply
  71. You’re looking at the now retired Subversion repository for WebRTC.

    Please refer to http://www.webrtc.org/ for the location of the source code.

    The source code you wrote in this tutorial was removed.

    Reply
  72. could not download from gclient config –name src http://webrtc.googlecode.com/svn/trunk , can any one please tell an alternate URL for ios Webrtc code , I searched in http://webrtc.org but could find ios in that a.

    Reply
  73. when I try to run gclient config –name src http://webrtc.googlecode.com/svn/trunk I get this error…env: bash\r: No such file or directory

    every time I try to work through examples of webrtc this and others I get the same but on different command?

    Reply
  74. hello,I am from china,I learn webrtc iOS,but I download the source code has many error
    like this:
    running ‘git -c core.deltaBaseCacheLimit=2g clone –no-checkout –progress –verbose https://chromium.googlesource.com/chromium/src.git /Users/yaoxin/src/src/chromium/_gclient_src_2vWNK0′ in ‘/Users/yaoxin/src/src/chromium’
    [0:00:00] Cloning into ‘/Users/yaoxin/src/src/chromium/_gclient_src_2vWNK0’…
    [0:00:02] POST git-upload-pack (gzip 363924 to 180443 bytes)
    [0:00:04] remote: Sending approximately 2.83 GiB …
    [0:00:04] remote: Counting objects: 1
    [0:00:05] remote: Counting objects: 100334, done
    [0:00:05] remote: Finding sources: 1% (33/3292)
    [0:00:05] remote: Finding sources: 10% (330/3292)
    [0:00:05] remote: Finding sources: 100% (3292/3292)

    Reply
  75. Note that they did their own script to build fat libraries
    https://code.google.com/p/webrtc/issues/detail?id=4119#c4

    Reply

Write a Comment Cancel reply