HMSSDK

class HMSSDK

Types

Link copied to clipboard
class Builder(context: Context)
Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun acceptChangeRole(request: HMSRoleChangeRequest, hmsActionResultListener: HMSActionResultListener)

When a peer is requested to change their role (see changeRole) to accept the new role this has to be called. Once this method is called, the peer's role will be changed to the requested one.

Link copied to clipboard
Link copied to clipboard
fun addPlugin(plugin: HMSVideoPlugin, hmsActionResultListener: HMSActionResultListener, pluginFrameRate: Int = 15)

Initializes video pre-processors such as Virtual Background and blur.

Link copied to clipboard

Network quality will begin to be measured and sent into the observer until the call ends. Only one observer may be active at a time. If multiple observers are added, the previous ones will be unregistered.

Link copied to clipboard
Link copied to clipboard
fun changeMetadata(metadata: String, hmsActionResultListener: HMSActionResultListener)

Change the metadata that appears inside HMSPeer.metadata. This change is persistent and all peers joining after the change will still see these values.

Link copied to clipboard
fun changeName(name: String, hmsActionResultListener: HMSActionResultListener)

Change the name that appears inside HMSPeer.name This change is persistent and all peers joining after the change will still see these values.

Link copied to clipboard
fun changeRole(forPeer: HMSPeer, toRole: HMSRole, force: Boolean, hmsActionResultListener: HMSActionResultListener)

Requests a change of HMSRole to a new role.

Link copied to clipboard
fun changeRoleOfPeer(forPeer: HMSPeer, toRole: HMSRole, force: Boolean, hmsActionResultListener: HMSActionResultListener)

Requests a change of HMSRole to a new role.

Link copied to clipboard
fun changeRoleOfPeersWithRoles(ofRoles: List<HMSRole>, toRole: HMSRole, hmsActionResultListener: HMSActionResultListener)

Requests a change of every peer with any role in ofRoles to have their roles changed to the role toRole.

Link copied to clipboard
fun changeTrackState(forRemoteTrack: HMSTrack, mute: Boolean, hmsActionResultListener: HMSActionResultListener)

To change the mute status of a single remote HMSTrack.

fun changeTrackState(mute: Boolean, type: HMSTrackType?, source: String?, roles: List<HMSRole>?, hmsActionResultListener: HMSActionResultListener)

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.

Link copied to clipboard
fun enableNoiseCancellation(enable: Boolean, hmsActionResultListener: HMSActionResultListener)

Turns noise cancellation on or off dynamically. It only applies when a call is active. No-op if called when no room is joined. To turn on noise cancellation by default look into the property enableNoiseCancellation of live.hms.video.media.settings.HMSAudioTrackSettings and set it in the builder property while creating an HMSSDK instance. Will not be enabled if isNoiseCancellationAvailable returns anything other than AvailabilityStatus.Available. isNoiseCancellationAvailable will also list the reason why it can't be enabled.

Link copied to clipboard
fun endRoom(reason: String, lock: Boolean, hmsActionResultListener: HMSActionResultListener)

End the room and make all participants leave.

Link copied to clipboard

get current available list of devices type through which audio output can be routed.

Link copied to clipboard

get current device type through which audio output is being routed.

Link copied to clipboard
fun getAuthTokenByRoomCode(tokenRequest: TokenRequest, tokenRequestOptions: TokenRequestOptions? = null, hmsTokenListener: HMSTokenListener)

Fetch room token by shortcode.

Link copied to clipboard
fun getDiagnosticsSDK(customerUserId: String?): HMSDiagnostics
Link copied to clipboard

Returns an instance of the local peer if one existed. A local peer only exists during a preview and an active call.

Link copied to clipboard
fun getPeerById(peerId: String): HMSPeer?

Given a peerId, returns the HMSPeer for that peerId.

Link copied to clipboard
fun getPeerListIterator(peerListIteratorOptions: PeerListIteratorOptions? = null): PeerListIterator
Link copied to clipboard

Returns all peers, remote and local.

Link copied to clipboard

Gets the list of active plugins.

Link copied to clipboard

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.

Link copied to clipboard
Link copied to clipboard

Returns a HMSRoom object if one is currently active. A room will be present after preview or after join. Will return null if the user is not currently in a preview or a room.

Link copied to clipboard
fun getRoomLayout(authToken: String, layoutRequestOptions: LayoutRequestOptions? = null, layoutListener: HMSLayoutListener)

Fetch layout config by token.

Link copied to clipboard

Returns whether noise cancellation is currently enabled. Will always return false if no room is joined. If this is unexpectedly false, check isNoiseCancellationAvailable.

Link copied to clipboard

Whether noise cancellation is available. Noise cancellation will not be available if the library is not imported. Look at Docs for details.

Link copied to clipboard

A method to check if the screen share is currently active on device

Link copied to clipboard
fun join(config: HMSConfig, hmsUpdateListener: HMSUpdateListener)

Join the call.

Link copied to clipboard
fun leave(hmsActionResultListener: HMSActionResultListener? = null)

Exit the call.

Link copied to clipboard

Lower local peer's hand.

Link copied to clipboard
fun lowerRemotePeerHand(forPeer: HMSPeer, actionlistener: HMSActionResultListener)

Lowers a remote peer's hand. The remote peer will be notified via HMSUpdateListener.onPeerUpdate

Link copied to clipboard
fun preview(config: HMSConfig, listener: HMSPreviewListener)

Begin a preview so that the local peer's audio and video can be displayed to them before they join a call.

fun preview(forRole: HMSRole, rolePreviewListener: RolePreviewListener)
Link copied to clipboard

API to raise local peer's hand

Link copied to clipboard
Link copied to clipboard
fun removePeerRequest(peer: HMSRemotePeer, reason: String, hmsActionResultListener: HMSActionResultListener)

Removes the given peer from the audio/video conference.

Link copied to clipboard
fun removePlugin(plugin: HMSVideoPlugin, hmsActionResultListener: HMSActionResultListener)

Removes a plugin and clears its effects.

Link copied to clipboard
Link copied to clipboard

Only in a large room, search for a peer's name.

Link copied to clipboard
fun sendBroadcastMessage(message: String, type: String = HMSMessageType.CHAT, hmsMessageResultListener: HMSMessageResultListener)

Sends a message to everyone in the call.

Link copied to clipboard
fun sendDirectMessage(message: String, type: String = HMSMessageType.CHAT, peerTo: HMSPeer, hmsMessageResultListener: HMSMessageResultListener)

Sends a message a particular peer only. The one specified in peerTo.

Link copied to clipboard
fun sendErrorEvent(hmsException: HMSException)

Sends the hls error event to analytics.

Link copied to clipboard
fun sendGroupMessage(message: String, type: String = HMSMessageType.CHAT, hmsRolesTo: List<HMSRole>, hmsMessageResultListener: HMSMessageResultListener)

Sends a message to the roles defined in hmsRolesTo. All peers currently with that role will receive the message.

Link copied to clipboard
fun setAudioDeviceChangeListener(audioManageDeviceChangeDeviceChangeListener: HMSAudioManager.AudioManagerDeviceChangeListener)

Set a listener to receive updates whenever audio changes.

Link copied to clipboard
fun setAudioMixingMode(audioMixingMode: AudioMixingMode)

Sets the mode in which audio mixing needs to be done after capturing the audio from system

Link copied to clipboard
fun setAudioMode(audioMode: Int)

Change Audio Mode manually. The most common usecase would be toggle between in-call volume/media volume

Link copied to clipboard
fun setHlsSessionMetadata(metadata: List<HMSHLSTimedMetadata>, hmsActionResultListener: HMSActionResultListener)

Sets the hls-session metadata. This information will be sent as a part of stream when streaming the content.

Link copied to clipboard
Link copied to clipboard

Does not check to see if permissions are really granted. If they aren't granted it will proceed and the tracks for which permissions are missing will be disabled.

Link copied to clipboard
@RequiresApi(value = 29)
fun startAudioshare(hmsActionResultListener: HMSActionResultListener, mediaProjectionPermissionResultData: Intent?, audioMixingMode: AudioMixingMode = AudioMixingMode.TALK_AND_MUSIC, audioShareNotification: Notification? = null)

Starts audio share of your android device. Only supported on Android 10 and above.

Link copied to clipboard
fun startHLSStreaming(config: HMSHLSConfig? = null, hmsActionResultListener: HMSActionResultListener)

Starts HLS streaming on the parameters described in config.

Link copied to clipboard

Starts real time transcription for all peers in the room.

Link copied to clipboard
fun startRtmpOrRecording(config: HMSRecordingConfig, hmsActionResultListener: HMSActionResultListener)

Starts rtmp streaming or recording on the parameters described in config.

Link copied to clipboard
fun startScreenshare(hmsActionResultListener: HMSActionResultListener, mediaProjectionPermissionResultData: Intent?, screenShareNotification: Notification? = null)

Start screen sharing from your android device.

Link copied to clipboard
fun stopAudioshare(hmsActionResultListener: HMSActionResultListener)

Stop audio sharing.

Link copied to clipboard
fun stopHLSStreaming(config: HMSHLSConfig? = null, hmsActionResultListener: HMSActionResultListener)

Stop HLS streaming on the parameters described in config.

Link copied to clipboard

Stops real time transcription for all peers in the room.

Link copied to clipboard
fun stopRtmpAndRecording(hmsActionResultListener: HMSActionResultListener)

Stops a previously started rtmp recording or stream. See startRtmpOrRecording for starting.

Link copied to clipboard
fun stopScreenshare(hmsActionResultListener: HMSActionResultListener)

Stops screen share.

Link copied to clipboard

Switch the device through which audio output should be sent.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard