CloudHub Docs
Download Documents

RTS


Quick start RTS SDK

Prepare the environment

Add the CloudHubRTS.framework file to the project

Configure project files

  1. Add the CloudHubRTS.framework file to the project

  2. Modify the reference settings of CloudHubRTS.framework,General–>Frameworks, Libraries, and Embedded Content image

  3. Build Settings Build Options->Enable Bitcode->Change to NO image

  4. Add dependency Library Build Phases->Link Binary With Libaries 添加必要依赖库: libc++.tbd image

Add device permissions

CloudHubRTS will use the microphone and camera of iOS device, so you need to add permission application in the info.plist file of the project

Integration steps——upStream

1. Create upStream

Before calling other APIs, you need to create and initialize RtsUpStream

When initializing RtsUpStream, you need to provide a callback event handler to provide specific information about the event,See Overview

// ViewController.h

//  CloudHubRTS 
#import <CloudHubRTS/CloudHubRTS.h>

//  RtsUpStreamDelegate
@interface ViewController : UIViewController <RtsUpStreamDelegate>
//  RtsUpStream 
@property (nonatomic, strong) RtsUpStream *pushStream;

2. Initializing RtsUpStream

Call createUpStreamWithClientId:delegate: initializing RtsUpStream

self.pushStream = [RtsEngine createUpStreamWithClientId:nil delegate:self];

3. Set up audio and video devices

[self.pushStream startCamera];
[self.pushStream startMicrophone];

4. Local Preview

Play your own video

[self.pushStream startPlayingLocalVideo:<#Your View#> renderMode:CloudHubVideoRenderModeHidden mirrorMode:CloudHubVideoMirrorModeAuto];

5. Start Push

NSString *url = <#your url#>;
int pushResult = [self.pushStream startPush:url];
if (pushResult)
{
    NSLog(@"Error! startPush failed pushResult=%d", pushResult);
}

6. Stop Push

[self.pushStream stopPush];
[RtsEngine deleteUpStream:self.pushStream];

Integration steps——downStream

1. Create downStream

Before calling other APIs, you need to create and initialize RtsDownStream

When initializing RtsDownStream you need to provide a callback event handler to provide specific information about the event,See Overview.

// ViewController.h

// CloudHubRTS 
#import <CloudHubRTS/CloudHubRTS.h>

//  RtsDownStreamDelegate
@interface ViewController : UIViewController <RtsDownStreamDelegate>
//  RtsUpStream 
@property (nonatomic, strong) RtsDownStream *pullStream;

2. Initialize RtsDownStream

Call createDownStreamWithClientId:delegate: initializing RtsDownStream

self.pullStream = [RtsEngine createDownStreamWithClientId:nil delegate:self];

3. Start Pull

NSString *url = <#your url#>;
int pullResult = [self.pullStream startPull:url];
if (pullResult)
{
    NSLog(@"Error! startPull failed pullResult=%d", pullResult);
}

4. Stop Pull

[self.pullStream stopPull];
[RtsEngine deleteDownStream:self.pullStream];