TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2015 |
Maintained by Thomas Shafer, Daniel Klein, Norm Brandinger.
Depends on: | |
libjingle_peerconnection | ~> 10842.2.3 |
Primus | >= 0 |
SocketRocket | ~> 0.4.2 |
This is the cine.io Peer iOS SDK. This library allows you to integrate real-time live video and audio chat to your iOS application. It is fully compatable with with the cine.io Peer Android SDK and cine.io peer JavaScript SDK.
The easiest way to use the SDK is via CocoaPods. Create a new
XCode project with a file named Podfile
that contains the
following:
pod 'cineio-peer-ios', '0.0.10'
Then, install the Pod by running the pod install
command:
pod install
Then you can open the project using the <project>.xcworkspace
file:
open <project>.xcworkspace
Check out the cineio-peer-ios-example-app repository for a working example that use this SDK.
Start by including the necessary files
#import "CinePeerClient.h"
#import "CinePeerClientConfig.h"
#import "CineCall.h"
#import "CineIdentity.h" // Only necessary if your app requires identifying
#import "RTCMediaStream.h"
#import "RTCEAGLVideoView.h" // For displaying media strems
For simplicity sake, let's make our ViewController
a CinePeerClientDelegate
In ViewController.m
@interface ViewController () <CinePeerClientDelegate>
In ViewController.m
, because that's our CinePeerClientDelegate
.
- (void)viewDidLoad {
[super viewDidLoad];
NSString *CINE_IO_PUBLIC_KEY = @"CINE_IO_PUBLIC_KEY";
NSString *CINE_IO_SECRET_KEY = @"CINE_IO_SECRET_KEY";
// Initialize the CinePeerClientConfig class
// Pass in a CinePeerClientDelegate
CinePeerClientConfig *config = [[CinePeerClientConfig alloc] initWithPublicKey:CINE_IO_PUBLIC_KEY delegate:self];
// Create the peer client
CinePeerClient *cinePeerClient = [[CinePeerClient alloc] initWithConfig:config];
}
CinePeerClientDelegate
methodsYou'll add the CinePeerClientDelegate
methods to your ViewController
.
// happens when a new peer joins, or your local camera and microphone starts
- (void) addStream:(RTCMediaStream *)stream peerConnection:(RTCPeerConnection *)peerConnection local:(BOOL)local;
// happens when a peer leaves, or your local camera and microphone stops
- (void) removeStream:(RTCMediaStream *)stream peerConnection:(RTCPeerConnection *)peerConnection local:(BOOL)local;
// when a new call comes in
- (void) handleCall:(CineCall *)call;
// when a call that came to you is cancelled
- (void) onCallCancel:(CineCall *)call;
// when a call that you sent out is rejected
- (void) onCallReject:(CineCall *)call;
// generic error catcher
- (void) handleError:(NSDictionary *)error;
CinePeerClient
Methods[cinePeerClient startMediaStream];
NSString *roomName = @"example";
[cinePeerClient joinRoom:roomName];
You'll need to set the secretKey on the config to identify.
[config setSecretKey:CINE_IO_SECRET_KEY];
NSString *identityName = @"UNIQUE-IDENTITY";
CineIdentity *identity = [config generateIdentity:identityName];
[self.cinePeerClient identify:identity];
NSString *identityName = @"UNIQUE-IDENTITY-TO-CALL";
[self.cinePeerClient call:identity];
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)