Last active
August 29, 2015 14:11
-
-
Save ykst/7245c8e1fcefd94f3794 to your computer and use it in GitHub Desktop.
iOSでWebRTCアプリを作ってみる (組み込み編) ref: http://qiita.com/ykst/items/fa1968b9a886d1505d61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/webrtc | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
export PATH=`pwd`/depot_tools:$PATH | |
gclient config --name src http://webrtc.googlecode.com/svn/trunk | |
echo "target_os = ['ios']" >> .gclient | |
gclient sync --force | |
export GYP_GENERATORS="ninja" | |
export GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 libjingle_objc=1 OS=ios target_arch=armv7" | |
export GYP_GENERATOR_FLAGS="$GYP_GENERATOR_FLAGS output_dir=out_ios" | |
export GYP_CROSSCOMPILE=1 | |
pushd src | |
gclient runhooks | |
ninja -C out_ios/Release-iphoneos AppRTCDemo | |
popd | |
libtool -static -o src/out_ios/Release-iphoneos/libWebRTC-ios.a src/out_ios/Release-iphoneos/*.a | |
strip -S -x -o src/out_ios/Release-iphoneos/libWebRTC-ios-min.a -r src/out_ios/Release-iphoneos/libWebRTC-ios.a | |
cp src/out_ios/Release-iphoneos/libWebRTC-ios-min.a . | |
cp -r src/third_party/libjingle/source/talk/app/webrtc/objc/public . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AssertionError: Multiple codesigning fingerprints for identity: iPhone Developer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'iPhone Developer' -> '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libstdc++.dylib | |
libicucore.dylib | |
GLKit.framework | |
libsqlite3.0.dylib | |
AVFoundation.framework | |
libWebRTC-ios-min.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <AVFoundation/AVFoundation.h> | |
#import "RTCEAGLVideoView.h" | |
#import "RTCMediaStream.h" | |
#import "RTCPeerConnectionFactory.h" | |
#import "RTCMediaConstraints.h" | |
#import "RTCPeerConnection.h" | |
#import "RTCPair.h" | |
#import "RTCVideoCapturer.h" | |
#import "RTCVideoTrack.h" | |
#import "RTCAudioTrack.h" | |
#import "RTCICECandidate.h" | |
#import "RTCSessionDescription.h" | |
#import "ViewController.h" | |
@implementation ViewController { | |
RTCMediaStream *_local_media_stream; | |
RTCPeerConnection *_peer; | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
RTCPeerConnectionFactory *pc_factory = [RTCPeerConnectionFactory new]; | |
_peer = [pc_factory peerConnectionWithICEServers:nil constraints:nil delegate:nil]; | |
RTCEAGLVideoView * local_view = [[RTCEAGLVideoView alloc] initWithFrame:self.view.frame]; | |
[self.view addSubview:local_view]; | |
_local_media_stream = [pc_factory mediaStreamWithLabel:@"ARDAMS"]; | |
NSString *camera_id = nil; | |
for (AVCaptureDevice *dev in [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo] ) { | |
if (dev.position == AVCaptureDevicePositionFront) { | |
camera_id = [dev localizedName]; | |
break; | |
} | |
} | |
RTCVideoCapturer *capturer = [RTCVideoCapturer capturerWithDeviceName:camera_id]; | |
RTCVideoSource *source = [pc_factory videoSourceWithCapturer:capturer constraints:nil]; | |
RTCVideoTrack *video_track = [pc_factory videoTrackWithID:@"ARDAMSv0" source:source]; | |
[_local_media_stream addVideoTrack:video_track]; | |
[video_track addRenderer:local_view]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment