HMSSDK

CLASS

@objcMembers public class HMSSDK: NSObject

The public interface of 100ms SDK. Create an instance of HMSSDK to start using the SDK. Key Concepts Room - A room represents a real-time audio, video session, the basic building block of the 100mslive Video SDK Track - A track represents either the audio or video that makes up a stream Peer - A peer represents all participants connected to a room. Peers can be "local" or "remote" Broadcast - A local peer can send any message/data to all remote peers in the room HMSSDK has other methods which the client app can use to get more info about the Room, Peer and Tracks

Properties

localPeer

public var localPeer: HMSLocalPeer?

Returns the local peer, which contains the local tracks

remotePeers

public var remotePeers: [HMSRemotePeer]?

Returns all remote peers in the room

roles

public var roles: [HMSRole]

Returns all roles in the room

room

public var room: HMSRoom?

Returns the room which was joined

trackSettings

public var trackSettings: HMSTrackSettings = HMSTrackSettings()

to set a track settings different from default

analyticsLevel

public var analyticsLevel: HMSAnalyticsEventLevel = .error

set the analytical level

logLevel

public var logLevel: HMSLogLevel = .error

set the logging level

logger

public weak var logger: HMSLogger?

Methods

join(config:delegate:)

public func join(config: HMSConfig, delegate: HMSUpdateListener)

To join a room created, clients need to create a HMSConfig instance and use that instance to call join method of HMSSDK Use the HMSConfig and HMSUpdateListener instances to call join method on the instance of HMSSDK. Once Join succeeds, all the callbacks keep coming on every change in the room and the app can react accordingly

  • Parameters:
    • config: the config object instance which contains joining information
    • delegate: the update listener object which will receive all callbacks

Parameters

NameDescription
configthe config object instance which contains joining information
delegatethe update listener object which will receive all callbacks

leave()

public func leave()

Call the leave method on the HMSSDK instance to leave a room

preview(config:delegate:)

public func preview(config: HMSConfig, delegate: HMSPreviewListener)

send(message:)

public func send(message: HMSMessage)

add(delegate:)

public func add(delegate: HMSUpdateListener)

remove(delegate:)

public func remove(delegate: HMSUpdateListener)

changeRole(for:to:force:)

public func changeRole(for peer:HMSRemotePeer, to role: HMSRole, force: Bool = false)

accept(changeRole:)

public func accept(changeRole request: HMSRoleChangeRequest)

build(block:)

public static func build(block: ((HMSSDK) -> Void)? = nil) -> HMSSDK

this will instantiate an HMSSDK object

  • Parameter block: pass a block with different settings as required
  • Returns: an instance of HMSSDK object

Parameters

NameDescription
blockpass a block with different settings as required