This is an iOS example application using cine.io Peer iOS SDK. It supports joining rooms, identifying, calling, and showing local and remove streams.
- Clone to your local machine:
git clone git@github.com:cine-io/cineio-peer-ios-example-app.git
cd cineio-peer-ios-example-app
-
Register for a public and secret key at cine.io
-
Install the pods in the CineIOPeerExampleApp directory
cd CineIOPeerExampleApp && pod install
-
Open
CineIOPeerExampleApp.xcworkspace
in XCode -
Update
CINE_IO_PUBLIC_KEY
andCINE_IO_SECRET_KEY
in ViewController.m -
Press Run in XCode.
-
The app automatically connects to cine.io, starts the camera, and puts you in a room called
example
.
This class creates a new CinePeerClientConfig
and passes it to a new CinePeerClient
.
It then starts the camera, joins an example room. Identifying and calling can be commented in to test the identifying and calling functionality of cine.io.
This class is also a CinePeerClientDelegate
. It must implement the following methods:
- (void) addStream:(RTCMediaStream *)stream peerConnection:(RTCPeerConnection *)peerConnection local:(BOOL)local
- (void) removeStream:(RTCMediaStream *)mediaStream peerConnection:(RTCPeerConnection *)peerConnection local:(BOOL)local;
- (void) handleError:(NSDictionary *)error
- (void) handleCall:(CineCall *)call
- (void) onCallCancel:(CineCall *)call
- (void) onCallReject:(CineCall *)call
On addStream it creates a MediaStreamAndRenderer
. This holds the media stream and creates a renderer. It adds the newly created MediaStreamAndRenderer
to an array. Then it refreshes the UI showing all of the media streams.
On removeStream, it deletes the corresponding MediaStreamAndRenderer
and refreshes the UI.
This class holds all of the information associated with the media stream. It holds an instance of a RTCEAGLVideoView
, which is required to show the media stream. It also listens to video size changes and appropriately resizes the video and then tells the ViewController
to refresh the UI.