1 This directory contains the ObjectiveC implementation of the 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. 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. 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. 12 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() { 16 cd /path/to/webrtc/trunk 17 export GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1" 18 export GYP_GENERATORS="ninja" 19 } 20 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 } 27 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 } 34 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 } 40 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. 82