HMSSDK class

The public interface of 100ms SDK. Create an instance of HMSSDK to start using the SDK.

Parameters:

hmsTrackSetting - To modify local peer's audio & video tracks settings. Only required for advanced use cases. Refer hmsTrackSetting guide here

iOSScreenshareConfig - It is required for starting Screen share (broadcast screen) in iOS. Refer iOS Screen share guide here

hmsLogSettings - It is used to set the Log Level setting. Refer hmsLogSettings guide here

appGroupDeprecated - It is required for starting Screen share (broadcast screen) in iOS. Refer iOS Screen share guide here

preferredExtensionDeprecated - It is required for starting Screen share (broadcast screen) in iOS. Refer iOS Screen share guide here

Note: [appGroup] and [preferredExtension] are deprecated use iOSScreenshareConfig instead.

Key Concepts

Room - A room represents real-time audio, and video sessions, 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

Refer HMSSDK quick start guide available here

Constructors

HMSSDK({HMSTrackSetting? hmsTrackSetting, HMSIOSScreenshareConfig? iOSScreenshareConfig, HMSLogSettings? hmsLogSettings, @Deprecated("Use iOSScreenshareConfig") String? appGroup, @Deprecated("Use iOSScreenshareConfig") String? preferredExtension, bool isPrebuilt = false})
The public interface of 100ms SDK. Create an instance of HMSSDK to start using the SDK.

Properties

appGroup String?
appGroup is only used for screen share (broadcast screen) in iOS.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hmsLogSettings HMSLogSettings?
hmsLogSettings is used to set the Log Level setting.
getter/setter pair
hmsTrackSetting HMSTrackSetting?
To modify local peer's audio & video tracks settings use the hmsTrackSetting. Only required for advanced use cases.
getter/setter pair
iOSScreenshareConfig HMSIOSScreenshareConfig?
HMSIOSScreenshareConfig is required for starting Screen share (Broadcast screen) from iOS devices like iPhones & iPads. To learn more about Screen Share, refer to the guide here.
getter/setter pair
isPrebuilt bool
final
preferredExtension String?
preferredExtension is only used for screen share (broadcast screen) in iOS.
getter/setter pair
previewState bool
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acceptChangeRole({required HMSRoleChangeRequest hmsRoleChangeRequest, HMSActionResultListener? hmsActionResultListener}) Future<void>
accept the change role request
addLogListener({required HMSLogListener hmsLogListener}) → void
Method to add Log Listener to listen to the logs
addPreviewListener({required HMSPreviewListener listener}) → void
add one or more previewListeners.
addStatsListener({required HMSStatsListener listener}) → void
add listener to RTC Stats of the room to diagnose Metrics
addUpdateListener({required HMSUpdateListener listener}) → void
add UpdateListener it will add all the listeners.
build() Future<void>
The build function should be called after creating an instance of the HMSSDK.
cancelPreview() Future
Cancel the Previewing for Role invocation. If a previewForRole call was performed previously then calling this method clears the tracks created anticipating a Change of Role This method only needs to be called if the user declined the request for role change.
changeMetadata({required String metadata, HMSActionResultListener? hmsActionResultListener}) Future<void>
Change the metadata that appears inside HMSPeer.metadata. This change is persistent and all peers joining after the change will still see these values.
changeName({required String name, HMSActionResultListener? hmsActionResultListener}) Future<void>
Method to change name of local peer.
changeRoleOfPeer({required HMSPeer forPeer, required HMSRole toRole, bool force = false, HMSActionResultListener? hmsActionResultListener}) Future<void>
Requests a change of HMSRole to a new role.
changeRoleOfPeersWithRoles({required HMSRole toRole, required List<HMSRole> ofRoles, HMSActionResultListener? hmsActionResultListener}) → void
Method to change the role of all the peers with the same role
changeTrackState({required HMSTrack forRemoteTrack, required bool mute, HMSActionResultListener? hmsActionResultListener}) Future<void>
To change the mute status of a single remote peer's track.
changeTrackStateForRole({required bool mute, required HMSTrackKind? kind, required String? source, required List<HMSRole>? roles, HMSActionResultListener? hmsActionResultListener}) Future<void>
To change the mute status of one or many remote HMSTrack for all peers of a particular role, or all tracks of a particular source, type or source AND type.
destroy() → void
Method to destroy HMSSDK instance.
endRoom({required bool lock, required String reason, HMSActionResultListener? hmsActionResultListener}) Future<void>
Remove all the peers from the room & end the room.
enterPipMode({List<int>? aspectRatio, bool? autoEnterPip}) Future<bool>
Method to activate pipMode in the application
getAllLogs() Future<HMSLogList?>
Method to get all the logs from the SDK
getAudioDevicesList() Future<List<HMSAudioDevice>>
Method to get available audio devices
getAuthTokenByRoomCode({required String roomCode, String? userId, String? endPoint}) Future
getAuthTokenByRoomCode is used to get the authentication token to join the room using room codes.
getCurrentAudioDevice() Future<HMSAudioDevice>
Method to get current audio output device(Android Only)
getLocalPeer() Future<HMSLocalPeer?>
Returns an instance of the local peer if one existed. A local peer only exists during a preview and an active call. Returns null if no room is joined.
getPeerListIterator({PeerListIteratorOptions? peerListIteratorOptions}) Future
Method to get the peer list iterator in the room, only in case of large rooms
getPeers() Future<List<HMSPeer>?>
Returns all peers, remote and local. Returns null if no room is joined.
getRemotePeers() Future<List<HMSPeer>?>
Returns only remote peers. The peer's own instance will not be included in this. To get all peers including the local one consider getPeers or for only the local one consider getLocalPeer. Returns null if no room is joined.
getRoles() Future<List<HMSRole>>
Returns all the HMSRole roles possible in the room
getRoom() Future<HMSRoom?>
Get the HMSRoom room object that the local peer has currently joined. Returns null if no room is joined.
getRoomLayout({required String authToken, String? endPoint}) Future
getRoomLayout is used to get the layout themes for the room set in the dashboard.
getTrackSettings() Future<HMSTrackSetting>
Method to get Track Settings.
isAudioMute({HMSPeer? peer}) Future<bool>
To check the audio status of a peer is mute/unmute Pass in the peer object for the peer whose audio status you want to check
isPipActive() Future<bool>
Method to check whether pip mode is active currently
isPipAvailable() Future<bool>
Method to check whether pip mode is available for the current device
isScreenShareActive() Future<bool>
A method to check if the screen share is currently active on the device i.e. is this Android device doing screen share Note: This API is not available on iOS.
isVideoMute({HMSPeer? peer}) Future<bool>
To check the video status of a peer is mute/unmute Pass in the peer object for the peer whose video status you want to check
join({required HMSConfig config}) Future
Join the room with configuration options passed as an HMSConfig object. Refer Join Room guide here.
leave({HMSActionResultListener? hmsActionResultListener}) Future<void>
Call this method to leave the room HMSActionResultListener callback will be used by SDK to inform the application if there was a success or failure when the leave was executed
lowerLocalPeerHand({HMSActionResultListener? hmsActionResultListener}) → void
Method to lower hand for local peer
lowerRemotePeerHand({required HMSPeer forPeer, HMSActionResultListener? hmsActionResultListener}) → void
Method to lower remote peer's hand
muteRoomAudioLocally() Future<void>
To mute the audio of all peers in the room for yourself.
muteRoomVideoLocally() Future<void>
To mute the video of all peers in the room for yourself.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preview({required HMSConfig config}) Future<void>
Begin a preview so that the local peer's audio and video can be displayed to them before they join a call. The details of the call they want to join are passed using HMSConfig. This may affect whether they are allowed to publish audio or video at all.
previewForRole({required String role}) Future
Preview for a specific Role before changing it.
raiseLocalPeerHand({HMSActionResultListener? hmsActionResultListener}) → void
Method to raise hand for local peer
removeHMSLogger() → void
Method to remove attached HMSLogger
removeLogListener({required HMSLogListener hmsLogListener}) → void
Method to remove Log Listener
removePeer({required HMSPeer peer, required String reason, HMSActionResultListener? hmsActionResultListener}) Future<void>
Removes the given peer from the room.
removePreviewListener({required HMSPreviewListener listener}) → void
remove a preview listener
removeStatsListener({required HMSStatsListener listener}) → void
remove listener to RTC Stats of the room to diagnose Metrics
removeUpdateListener({required HMSUpdateListener listener}) → void
remove an update listener
sendBroadcastMessage({required String message, String type = "chat", HMSActionResultListener? hmsActionResultListener}) Future<void>
Sends a message to everyone on the call.
sendDirectMessage({required String message, required HMSPeer peerTo, String type = "chat", HMSActionResultListener? hmsActionResultListener}) Future<void>
Sends a message to a particular peer only.
sendGroupMessage({required String message, required List<HMSRole> hmsRolesTo, String type = "chat", HMSActionResultListener? hmsActionResultListener}) Future<void>
Sends a message to all the peers of a role defined in hmsRolesTo.
sendHLSTimedMetadata({required List<HMSHLSTimedMetadata> metadata, HMSActionResultListener? hmsActionResultListener}) Future<void>
Method to send Timed metadata for HLS Stream
setAudioMixingMode({required HMSAudioMixingMode audioMixingMode}) → void
Method to change the audio mixing mode of shared audio from other apps. (Android only)
startAudioShare({HMSActionResultListener? hmsActionResultListener, HMSAudioMixingMode audioMixingMode = HMSAudioMixingMode.TALK_AND_MUSIC}) Future<void>
Method to start audio share of other apps. (Android Only)
startHlsStreaming({HMSHLSConfig? hmshlsConfig, HMSActionResultListener? hmsActionResultListener}) Future<HMSException?>
Starts HLS streaming for the meetingUrl room. You can set a custom metadata for the HLS Stream hmsActionResultListener is a callback whose HMSActionResultListener.onSuccess will be called when the action completes successfully.
startHMSLogger({required HMSLogLevel webRtclogLevel, required HMSLogLevel logLevel}) → void
Method to start HMSLogger for logs
startRtmpOrRecording({required HMSRecordingConfig hmsRecordingConfig, HMSActionResultListener? hmsActionResultListener}) Future<void>
Starts rtmp streaming or recording on the parameters described in config.
startScreenShare({HMSActionResultListener? hmsActionResultListener}) Future<void>
Method to start screen share.
stopAudioShare({HMSActionResultListener? hmsActionResultListener}) Future<void>
Method to stop audio share of other apps. (Android Only)
stopHlsStreaming({HMSHLSConfig? hmshlsConfig, HMSActionResultListener? hmsActionResultListener}) Future<void>
Stops ongoing HLS streaming in the room hmsActionResultListener is a callback whose HMSActionResultListener.onSuccess will be called when the action completes successfully.
stopRtmpAndRecording({HMSActionResultListener? hmsActionResultListener}) Future<void>
Stops a previously started rtmp recording or stream. See startRtmpOrRecording for starting.
stopScreenShare({HMSActionResultListener? hmsActionResultListener}) → void
Method to stop screen share
switchAudio({bool isOn = false}) Future<HMSException?>
To switch local peer's audio on/off. Pass the bool value to isOn to change the current audio status
switchAudioOutput({required HMSAudioDevice audioDevice}) → void
Method to switch audio output device
switchAudioOutputUsingiOSUI() → void
**** Only for iOS **** Method to show the native iOS UI for switching the audio output device. This method natively switches the audio output to the selected device. Refer switch audio output iOS UI
switchCamera({HMSActionResultListener? hmsActionResultListener}) Future<void>
Switch camera to the front or rear mode
switchVideo({bool isOn = false}) Future<HMSException?>
To switch local peer's video on/off. Pass the bool value to isOn to change the current video status
toggleAlwaysScreenOn() → void
Method to toggle the always screen on capabilities(similar to wakelock)
toggleCameraMuteState() Future<HMSException?>
To switch local peer's video on/off. This function toggles the current camera state i.e If camera is unmuted it will get muted If camera is muted it will get unmuted Refer toggle camera state guide here.
toggleMicMuteState() Future<HMSException?>
To switch local peer's audio on/off. This function toggles the current microphone state i.e If it's unmuted it will get muted If it's muted it will get unmuted Refer toggle microphone state guide here.
toString() String
A string representation of this object.
inherited
unMuteRoomAudioLocally() Future<void>
To unmute the audio of all peers in the room for yourself if you had previously invoked muteRoomAudioLocally.
unMuteRoomVideoLocally() Future<void>
To unmute the video of all peers in the room for yourself.

Operators

operator ==(Object other) bool
The equality operator.
inherited