PeerObjectiveC
PeerObjectiveC is WebRTC client library for iOS, that communicate to peerjs-server.
Install / Use
/learn @hiroeorz/PeerObjectiveCREADME
PeerObjectiveC
About
<b>PeerObjectiveC</b> is WebRTC client library for iOS, that communicate to peerjs-server.
This library is modified from the AppRTCDemo (that Google has been published) for peerjs-server signaling process and PeerJS like API interface.
Usage
Build Sample App
-
Clone this repository.
$ git clone https://github.com/hiroeorz/PeerObjectiveC.git -
And build it on Xcode.
Use PeerObjectiveC in your custom app.
-
Clone this repository.
$ git clone https://github.com/hiroeorz/PeerObjectiveC.git -
Copy
Peerdirectory to your project, and add to your app on Xcode.$ cp -r PeerObjectiveC/Peer /path/to/yourapp/ -
You will need to add a few frameworks to your project in order for it to build correctly.
- libc++.dylib
- libicucore.dylib
- Security.framework
- CFNetwork.framework
- GLKit.framework
- libstdc++.6.dylib
- AudioToolbox.framework
- AVFoundation.framework
- CoreAudio.framework
- CoreMedia.framework
- CoreVideo.framework
- CoreGraphics.framework
- OpenGLES.framework
- QuartzCore.framework
- libsqlite3.dylib
-
Initialize
RTCPeerConnectionFactoryin your AppDelegate.mAppDelegate.m
#import "RTCPeerConnectionFactory.h" - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [RTCPeerConnectionFactory initializeSSL]; return YES; } -
And create instance of
Peerclass in ViewController.ViewController.m
#import <AVFoundation/AVFoundation.h> #import "Peer.h" @interface ViewController () <RTCEAGLVideoViewDelegate> @property(nonatomic, strong) Peer *peer; @end @implementation ViewController { @synthesize peer = _peer; - (void)viewDidAppear:(BOOL)animate { __block typeof(self) __self = self; // Create Configuration object. NSDictionary *config = @{@"key": @"your_api_key", @"port": @(9000)}; // Create Instance of Peer. _peer = [[Peer alloc] initWithConfig:config]; // Set Callbacks. _peer.onOpen = ^(NSString *id) { NSLog(@"onOpen"); }; _peer.onCall = ^(RTCSessionDescription *sdp) { NSLog(@"onCall"); }; _peer.onReceiveLocalVideoTrack = ^(RTCVideoTrack *videoTrack) { NSLog(@"onReceiveLocalVideoTrack"); }; _peer.onReceiveRemoteVideoTrack = ^(RTCVideoTrack *videoTrack) { NSLog(@"onReceiveRemoteVideoTrack"); }; _peer.onError = ^(NSError *error) { NSLog(@"onError: %@", error); }; _peer.onClose = ^() { NSLog(@"onClose"); }; // Start signaling to peerjs-server. [_peer start:^(NSError *error){ if (error) { NSLog(@"Error while openning websocket: %@", error); } }]; }All default configuration is here.
NSDictionary *config = @{@"host": @"0.peerjs.com", @"port": @(80), @"key": @"peerjs", @"path": @"/", @"secure": @(NO), @"config": @{ @"iceServers": @[ @{@"url": @"stun:stun.l.google.com:19302", @"user": @"", @"password": @""} ] }}; -
See example app, for more details.
License
MIT
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
