iOS SDK API Reference

Instance Methods | Properties | List of all members
SKWSFURoom Class Reference

SFU room class. More...

#import <SKWSFURoom.h>

Inheritance diagram for SKWSFURoom:
SKWRoom

Instance Methods

(void) - close
 Close PeerConnection and emit leave and close event.
 
(void) - replaceStream:
 Replace the stream being sent with a new one. More...
 
(BOOL) - send:
 Send data to all participants in the room with WebSocket. More...
 
(void) - on:callback:
 Set blocks for SKWRoom events. More...
 
(void) - offAll
 Cancels the set event callback block of SKWRoom. More...
 
(void) - getLog
 Start getting room's logs from signaling server. More...
 

Properties

NSString *__nullable name
 Room name.
 

Detailed Description

SFU room class.

Class that manages SFU type room.

Method Documentation

◆ getLog

- (void) getLog

Start getting room's logs from signaling server.

The result is returned in the SKW_ROOM_EVENT_LOG event.

SKWRoom* room;
[room on:SKW_ROOM_EVENT_LOG callback:^(NSObject* arg1, NSObject* arg2) {
NSArray* logs = (NSArray*)arg1;
[logs enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL* stop) {
NSString* logStr = (NSString*)obj;
NSError* error = nil;
id logData = [NSJSONSerialization JSONObjectWithData:[logStr dataUsingEncoding:NSUTF8StringEncoding]
options:0
error:&error];
if (nil == error)
{
NSLog(@"SKW_ROOM_EVENT_LOG: %@", logData);
}
}];
}];
[room getLog];

◆ offAll

- (void) offAll

Cancels the set event callback block of SKWRoom.

SKWRoom* room;
[room offAll];

◆ on:callback:

- (void) on: (SKWRoomEventEnum event
callback: (SKWRoomEventCallback __nullable)  callback 

Set blocks for SKWRoom events.

SKWRoom* room;
[room on:SKW_ROOM_EVENT_STREAM callback:^(NSObject* arg1, NSObject* arg2) {
SKWMediaStream* stream = (SKWMediaStream*)arg1;
}];
[room on:SKW_ROOM_EVENT_REMOVE_STREAM callback:^(NSObject* arg1, NSObject* arg2) {
SKWMediaStream* stream = (SKWMediaStream*)arg1;
}];
[room on:SKW_ROOM_EVENT_OPEN callback:^(NSObject* arg1, NSObject* arg2) {
NSString* roomName = (NSString*)arg1;
}];
[room on:SKW_ROOM_EVENT_CLOSE callback:^(NSObject* arg1, NSObject* arg2) {
NSString* roomName = (NSString*)arg1;
}];
[room on:SKW_ROOM_EVENT_PEER_JOIN callback:^(NSObject* arg1, NSObject* arg2) {
NSString* peerId = (NSString*)arg1;
}];
[room on:SKW_ROOM_EVENT_PEER_LEAVE callback:^(NSObject* arg1, NSObject* arg2) {
NSString* peerId = (NSString*)arg1;
}];
[room on:SKW_ROOM_EVENT_ERROR callback:^(NSObject* arg1, NSObject* arg2) {
SKWPeerError* error = (SKWPeerError*)arg1;
}];
[room on:SKW_ROOM_EVENT_DATA callback:^(NSObject* arg1, NSObject* arg2) {
NSString* peerId = (NSString*)arg1;
if ([arg2 isKindOfClass:[NSString class]]) {
NSString* data = (NSString*)arg2;
}
else if ([arg2 isKindOfClass:[NSData class]]) {
NSData* data = (NSData*)arg2;
}
}];
[room on:SKW_ROOM_EVENT_LOG callback:^(NSObject* arg1, NSObject* arg2) {
NSArray* logs = (NSArray*)arg1;
}];
Parameters
eventEvent type
callbackCallback block literal

◆ replaceStream:

- (void) replaceStream: (SKWMediaStream *__nullable)  newStream

Replace the stream being sent with a new one.

SKWSFURoom* room;
[room replaceStream:stream];
Parameters
newStreamThe stream to replace the old stream with.

◆ send:

- (BOOL) send: (NSObject *__nonnull)  data

Send data to all participants in the room with WebSocket.

It emits broadcast event. The max size of data that can be sent is 20MB. The frequent of consecutive send is limited to once every 100 msec. Outgoing data that exceeds the sending frequency limit is queued and sent sequentially every 100 msec.

SKWRoom* room;
[room send:@"Hello."];
Parameters
dataSend data
Returns
Result.
-[SKWRoom send:]
BOOL send:(NSObject *__nonnull data)
Send data to all participants in the room with WebSocket.
SKWPeerError
Error information class.
Definition: SKWPeerError.h:55
-[SKWRoom on:callback:]
void on:callback:(SKWRoomEventEnum event,[callback] SKWRoomEventCallback __nullable callback)
Set blocks for SKWRoom events.
-[SKWRoom offAll]
void offAll()
Cancels the set event callback block of SKWRoom.
-[SKWRoom getLog]
void getLog()
Start getting room's logs from signaling server.
SKWMediaStream
Media stream.
Definition: SKWMediaStream.h:18
SKWRoom
Room base class.
Definition: SKWRoom.h:64
SKWSFURoom
SFU room class.
Definition: SKWSFURoom.h:24
-[SKWSFURoom replaceStream:]
void replaceStream:(SKWMediaStream *__nullable newStream)
Replace the stream being sent with a new one.