Circall getting started - Straas/Straas-iOS-sdk GitHub Wiki
Overview
StraaS CirCall SDK provides a easy way to establish a video conferencing to StraaS!
Getting Started
This shows you how to start a CirCall step by step. You could read appledoc for more detail about the code this page mentions below.
Permission
Before using CircallManager, you have to get permission of camera and microphone for CircallManager.
Credential
Fulfill SDK Authentication to enable StraaS CirCall SDK.
Initial
- To get a CircallManager, you should call
[[CircallManager alloc] init]
or[CircallManager new]
.
Prepare
- After getting a CircallManager, you can use
preapare
to put configuration in CircallManager to create a local stream that you can publish later. For users who subscribe stream only, it's not necessary to
STSCircallStreamConfig * streamConfig = [STSCircallStreamConfig new];
streamConfig.minVideoSize = CGSizeMake(640, 360);
[self.circallManager prepareWithPreviewView:previewView streamConfig:streamConfig success:^(STSCircallStream * stream) {
// success callback
} failure:^(NSError *error) {
// failure callback
}];
STSCircallStreamConfig is for setting max video size and mix video size while publsihing or subscribing.
PreviewView is the view that CircallManager will render the stream on. You can use the stream in the callback to render on STSCircallPlayerView by setting the stream, also.
You can set up delegate STSCircallManagerDelegate
to receive delegate callback from STSCircallManager, too.
Connect
You would need to connect to a "room" to publish your local stream or subscribe to streams in the room. Here is a snippet for showing how to connect to a room.
[self.circallManager connectWithCircallToken:circallToken success:^{
// success callback
} failure:^(NSError * _Nonnull error) {
// failure callback
}];
circallToken
is a token for accessing Circall API, you would need to get it with Circall token API from your backend.
Publish
To publish your local stream, you would need to prepare STSCircallPublishConfig
to set up the max video and audio bit rate.
STSCircallPublishConfig * config = [STSCircallPublishConfig new];
config.maxVideoBitrate = @(600000);
config.maxAudioBitrate = @(64000);
[self.circallManager publishWithConfig:config];
Subscribe
Users in a room can subscribe published streams in the room. You may find the new added stream from STSCircallManagerDelegate
, and then you can subscribe it.
- (void)circallManager:(STSCircallManager *)manager didAddStream:(STSCircallStream *)stream {
[manager subscribeStream:stream];
}
Then you would get the stream you subscribed in this delegate callback.
- (void)circallManager:(STSCircallManager *)manager didSubscribeStream:(STSCircallStream *)stream {
// start render your stream on STSCircallPlayerView
}