henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | This directory contains the ObjectiveC implementation of the |
fischman@webrtc.org | 1bc1954 | 2013-08-01 18:29:45 +0000 | [diff] [blame^] | 2 | webrtc::PeerConnection API. This can be built for Mac or iOS. This |
| 3 | file describes building the API, unit test, and AppRTCDemo sample app. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 4 | |
| 5 | Prerequisites: |
| 6 | - Make sure gclient is checking out tools necessary to target iOS: your |
| 7 | .gclient file should contain a line like: |
| 8 | target_os = ['ios', 'mac'] |
| 9 | Make sure to re-run gclient sync after adding this to download the tools. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 10 | |
fischman@webrtc.org | 1bc1954 | 2013-08-01 18:29:45 +0000 | [diff] [blame^] | 11 | - Set up webrtc-related $GYP_DEFINES; example shell functions that set |
| 12 | up for building for iOS-device, iOS-simulator, and Mac (resp) are: |
| 13 | function wrbase() { |
| 14 | cd /path/to/libjingle/trunk |
| 15 | export GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1" |
| 16 | export GYP_GENERATORS="ninja" |
| 17 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 18 | |
fischman@webrtc.org | 1bc1954 | 2013-08-01 18:29:45 +0000 | [diff] [blame^] | 19 | function wrios() { |
| 20 | wrbase |
| 21 | export GYP_DEFINES="$GYP_DEFINES OS=ios target_arch=armv7" |
| 22 | export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_ios" |
| 23 | export GYP_CROSSCOMPILE=1 |
| 24 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 25 | |
fischman@webrtc.org | 1bc1954 | 2013-08-01 18:29:45 +0000 | [diff] [blame^] | 26 | function wrsim() { |
| 27 | wrbase |
| 28 | export GYP_DEFINES="$GYP_DEFINES OS=ios target_arch=ia32" |
| 29 | export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_sim" |
| 30 | export GYP_CROSSCOMPILE=1 |
| 31 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 32 | |
fischman@webrtc.org | 1bc1954 | 2013-08-01 18:29:45 +0000 | [diff] [blame^] | 33 | function wrmac() { |
| 34 | wrbase |
| 35 | export GYP_DEFINES="$GYP_DEFINES OS=mac target_arch=x64" |
| 36 | export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_mac" |
| 37 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 38 | |
fischman@webrtc.org | 1bc1954 | 2013-08-01 18:29:45 +0000 | [diff] [blame^] | 39 | - Finally, run "gclient runhooks" to generate ninja files. |
| 40 | |
| 41 | Example of building & using the unittest & app: |
| 42 | |
| 43 | - To build & run the unittest (must target mac): |
| 44 | wrmac && gclient runhooks && \ |
| 45 | ninja -C out_mac/Debug libjingle_peerconnection_objc_test && \ |
| 46 | ./out_mac/Debug/libjingle_peerconnection_objc_test.app/Contents/MacOS/libjingle_peerconnection_objc_test |
| 47 | |
| 48 | - To build & launch the sample app on the iOS simulator: |
| 49 | wrsim && gclient runhooks && ninja -C out_sim/Debug iossim AppRTCDemo && \ |
| 50 | ./out_sim/Debug/iossim out_sim/Debug/AppRTCDemo.app |
| 51 | |
| 52 | - To build & sign the sample app for an iOS device: |
| 53 | wrios && gclient runhooks && ninja -C out_ios/Debug AppRTCDemo |
| 54 | |
| 55 | - To install the sample app on an iOS device: |
| 56 | ideviceinstaller -i out_ios/Debug/AppRTCDemo.app |
| 57 | (if installing ideviceinstaller from brew, use --HEAD to get support |
| 58 | for .app directories) |
| 59 | - Alternatively, use iPhone Configuration Utility: |
| 60 | - Open "iPhone Configuration Utility" (http://support.apple.com/kb/DL1465) |
| 61 | - Click the "Add" icon (command-o) |
| 62 | - Open the app under out_ios/Debug/AppRTCDemo (should be added to the Applications tab) |
| 63 | - Click the device's name in the left-hand panel and select the Applications tab |
| 64 | - Click Install on the AppRTCDemo line. |
| 65 | (If you have any problems deploying for the first time, check |
| 66 | the Info.plist file to ensure that the Bundle Identifier matches |
| 67 | your phone provisioning profile, or use a development wildcard |
| 68 | provisioning profile.) |
| 69 | |
| 70 | - Once installed: |
| 71 | - Tap AppRTCDemo on the iOS device's home screen (might have to scroll to find it). |
| 72 | - In desktop chrome, navigate to http://apprtc.appspot.com and note |
| 73 | the r=<NNN> room number in the resulting URL; enter that number |
| 74 | into the text field on the phone. |
| 75 | - Alternatively, background the app and launch Safari. In Safari, |
| 76 | open the url apprtc://apprtc.appspot.com/?r=<NNN> where <NNN> is |
| 77 | the room name. Other options are to put the link in an email/chat |
| 78 | and send it to yourself. Clicking on it will launch AppRTCDemo |
| 79 | and navigate to the room. |