This directory contains the ObjectiveC implementation of the
webrtc::PeerConnection API.  This can be built for Mac or iOS.  This
file describes building the API, unit test, and AppRTCDemo sample app.

Prerequisites:
- Make sure gclient is checking out tools necessary to target iOS: your
  .gclient file should contain a line like:
  target_os = ['ios', 'mac']
  Make sure to re-run gclient sync after adding this to download the tools.
  Note that until http://crbug.com/248168 is fixed one needs to do a gclient
  sync with just 'mac' and then follow that with a sync with both.

- Set up webrtc-related $GYP_DEFINES; example shell functions that set
  up for building for iOS-device, iOS-simulator, and Mac (resp) are:
function wrbase() {
  cd /path/to/webrtc/trunk
  export GYP_DEFINES="build_with_libjingle=1 build_with_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 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
}

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

- Finally, run "gclient runhooks" to generate ninja files.

Example of building & using the unittest & app:

- To build & run the unittest (must target mac):
  wrmac && gclient runhooks && \
      ninja -C out_mac/Debug libjingle_peerconnection_objc_test && \
      ./out_mac/Debug/libjingle_peerconnection_objc_test.app/Contents/MacOS/libjingle_peerconnection_objc_test

- To build & launch the sample app on the iOS simulator:
  wrsim && gclient runhooks && ninja -C out_sim/Debug iossim AppRTCDemo && \
      ./out_sim/Debug/iossim out_sim/Debug/AppRTCDemo.app

- To build & sign the sample app for an iOS device:
  wrios && gclient runhooks && ninja -C out_ios/Debug AppRTCDemo

- To install the sample app on an iOS device:
  ideviceinstaller -i out_ios/Debug/AppRTCDemo.app
  (if installing ideviceinstaller from brew, use --HEAD to get support
  for .app directories)
- Alternatively, use iPhone Configuration Utility:
  - Open "iPhone Configuration Utility" (http://support.apple.com/kb/DL1465)
  - Click the "Add" icon (command-o)
  - Open the app under out_ios/Debug/AppRTCDemo (should be added to the Applications tab)
  - Click the device's name in the left-hand panel and select the Applications tab
  - Click Install on the AppRTCDemo line.
      (If you have any problems deploying for the first time, check
      the Info.plist file to ensure that the Bundle Identifier matches
      your phone provisioning profile, or use a development wildcard
      provisioning profile.)

- Once installed:
  - Tap AppRTCDemo on the iOS device's home screen (might have to scroll to find it).
  - In desktop chrome, navigate to http://apprtc.appspot.com and note
    the r=<NNN> room number in the resulting URL; enter that number
    into the text field on the phone.
  - Alternatively, background the app and launch Safari.  In Safari,
    open the url apprtc://apprtc.appspot.com/?r=<NNN> where <NNN> is
    the room name.  Other options are to put the link in an email/chat
    and send it to yourself.  Clicking on it will launch AppRTCDemo
    and navigate to the room.
