EricssonResearch / openwebrtc-ios-sdk

SDK for adding OpenWebRTC to your iOS apps using CocoaPods
BSD 2-Clause "Simplified" License
69 stars 37 forks source link

pod version Badge w/ Platform

OpenWebRTC iOS SDK

SDK for adding OpenWebRTC to your iOS apps using CocoaPods

Installation

The SDK uses CocoaPods as library dependency manager. In order to set this up:

sudo gem install cocoapods
pod setup

The OpenWebRTC SDK is made up of 2 different pods:

Usage

Example Podfile:

platform :ios, '8.0'

target 'NativeDemo' do
    pod 'OpenWebRTC', '~> 0.1'
    pod 'OpenWebRTC-SDK',  :git => 'https://github.com/EricssonResearch/openwebrtc-ios-sdk.git'
end

or

platform :ios, '8.0'

target 'NativeDemo' do
    pod 'OpenWebRTC'
    pod 'OpenWebRTC-SDK', :path => '../../../openwebrtc-ios-sdk/OpenWebRTC-SDK.podspec'
end

Examples

Apps that use the OpenWebRTC iOS SDK:

API

The entry point class for Native app developement is OpenWebRTCNativeHandler:

@protocol OpenWebRTCNativeHandlerDelegate <NSObject>

- (void)answerGenerated:(NSDictionary *)answer;
- (void)offerGenerated:(NSDictionary *)offer;
- (void)candidateGenerated:(NSDictionary *)candidate;

/**
 * Format of sources:
 * [{'name':xxx, 'source':xxx, 'mediaType':'audio' or 'video'}, {}, ...]
 */
- (void)gotLocalSources:(NSArray *)sources;
- (void)gotRemoteSource:(NSDictionary *)source;

@end

@interface OpenWebRTCNativeHandler : NSObject

@property (nonatomic, weak) id <OpenWebRTCNativeHandlerDelegate> delegate;
@property (nonatomic, strong) OpenWebRTCSettings *settings;

- (instancetype)initWithDelegate:(id <OpenWebRTCNativeHandlerDelegate>)delegate;

- (void)setSelfView:(OpenWebRTCVideoView *)selfView;
- (void)removeSelfView;
- (void)setRemoteView:(OpenWebRTCVideoView *)remoteView;
- (void)removeRemoteView;
- (void)addSTUNServerWithAddress:(NSString *)address port:(NSInteger)port;
- (void)addTURNServerWithAddress:(NSString *)address port:(NSInteger)port username:(NSString *)username password:(NSString *)password isTCP:(BOOL)isTCP;

- (void)startGetCaptureSourcesForAudio:(BOOL)audio video:(BOOL)video;
- (void)initiateCall;
- (void)terminateCall;

- (void)handleOfferReceived:(NSDictionary *)offer;
- (void)handleAnswerReceived:(NSDictionary *)answer;
- (void)handleRemoteCandidateReceived:(NSDictionary *)candidate;

- (void)setVideoCaptureSourceByName:(NSString *)name;
- (void)videoView:(OpenWebRTCVideoView *)videoView setVideoRotation:(NSInteger)degrees;
- (void)videoView:(OpenWebRTCVideoView *)videoView setMirrored:(BOOL)isMirrored;
- (NSInteger)rotationForVideoView:(OpenWebRTCVideoView *)videoView;

@end

Change log

See https://github.com/EricssonResearch/openwebrtc-ios-sdk/releases