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