Room
@objcMembers
@objc(SBCRoom)
public class Room : NSObject, RoomDataSource, RoomSender
A class that provides the enter()
, exit()
, and other methods, which handle information about the room and operate with other types of objects such as a participant.
Since
1.6.0-
Returns a room ID.
Since
1.6.0Declaration
Swift
public private(set) var roomId: String { get }
-
The timestamp of when the room was created, in Unix milliseconds.
Since
1.6.0Declaration
Swift
public private(set) var createdAt: Int64 { get }
-
The ID of a user who created a room.
Since
1.6.0Declaration
Swift
public private(set) var createdBy: String { get }
-
The local participant in a room.
Since
1.6.0Declaration
Swift
public var localParticipant: LocalParticipant? { get }
-
The list of all participants in a room.
Since
1.6.0Declaration
Swift
public var participants: [Participant] { get }
-
The list of remote participants in a room.
Since
1.6.0Declaration
Swift
public var remoteParticipants: [RemoteParticipant] { get }
-
The state of a room. Valid values are
.open
and.deleted
.Since
1.6.0Declaration
Swift
public internal(set) var state: State { get }
-
Indicates the room type as audio or video and the capacity of a room.
Since
1.6.0Declaration
Swift
public let type: RoomType
-
Custom items for this room
Since
1.8.0Declaration
Swift
public internal(set) var customItems: [String : String] { get }
-
Enters a room. The participant’s audio or video can be configured with
RoomEnterParams
when entering.Since
1.6.0
Declaration
Swift
@objc(enterWithParams:completionHandler:) public func enter(with params: EnterParams, completionHandler: @escaping ErrorHandler)
Parameters
completionHandler
Callback completionHandler to be called after entering the room.
-
Exits a room.
Throws
1800702 error code if the participant is not in the room and the request can’t be processed.
Since
1.6.0
Declaration
Swift
public func exit() throws
-
Get latest custom items for this room
Declaration
Swift
public func fetchCustomItems(completionHandler: @escaping CustomItemsResultHandler)
-
Updates custom items for this room.
Since
1.8.0
Declaration
Swift
public func updateCustomItems( customItems: [String: String], completionHandler: @escaping CustomItemsHandler )
Parameters
customItems
Custom items (String dictionary) to be updated or inserted.
completionHandler
Callback completionHandler. Contains custom items, changes custom items, and error.
-
Deletes custom items of the call.
Since
1.8.0
Declaration
Swift
public func deleteCustomItems(customItemKeys: [String], completionHandler: @escaping CustomItemsHandler)
Parameters
customItemKeys
Keys of the custom item that you want to delete.
completionHandler
Callback completionHandler. Contains custom items, changes custom items, and error.
-
Deletes all custom items of the call.
Since
1.8.0
Declaration
Swift
public func deleteAllCustomItems(completionHandler: @escaping CustomItemsHandler)
Parameters
completionHandler
Callback completionHandler. Contains custom items, changes custom items, and error.
-
Adds
RoomDelegate
to receive events about a room.room.addDelegate(self, identifier: UNIQUE_ID)
Since
1.6.0Declaration
Swift
public func addDelegate(_ delegate: RoomDelegate, identifier: String)
Parameters
delegate
RoomDelegate
that listens toRoom
events.identifier
Identifier for the specific delegate.
-
Removes a delegate to stop receiving events about a room.
room.removeDelegate(identifier: UNIQUE_ID)
Since
1.6.0Declaration
Swift
public func removeDelegate(identifier: String)
Parameters
identifier
String identifier for the delegate. If the room doesn’t have the given identifier, it will be ignored.
-
Removes all delegate to stop receiving events about a room.
Since
1.6.0Declaration
Swift
public func removeAllDelegates()
-
Declaration
Swift
@objcMembers @objc(SBCRoomEnterParams) public class EnterParams : NSObject
-
Declaration
Swift
@objc(SBCRoomState) public enum State : Int, RawRepresentable, Codable