Skip to content

cine-io/cineio-peer-ios-example-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cine.io peer iOS example

This is an iOS example application using cine.io Peer iOS SDK. It supports joining rooms, identifying, calling, and showing local and remove streams.

How to run locally

  1. 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 and CINE_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.

Code Walkthrough

ViewController.m

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.

MediaStreamAndRenderer.m

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.

About

iOS example app for realtime video chat using cine.io

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published