Web SDK API Reference

Enumerations

Classes

Core Interfaces

Other Interfaces

References

IHMSNotifications

Renames and re-exports HMSNotifications

Type Aliases

HMSGroupName

Ƭ HMSGroupName: string


HMSMessageID

Ƭ HMSMessageID: string


HMSNotification

Ƭ HMSNotification: HMSPeerNotification | HMSPeerListNotification | HMSTrackNotification | HMSMessageNotification | HMSExceptionNotification | HMSChangeTrackStateRequestNotification | HMSChangeMultiTrackStateRequestNotification | HMSLeaveRoomRequestNotification | HMSDeviceChangeEventNotification | HMSReconnectionNotification | HMSPlaylistItemNotification<any>


HMSNotificationCallback

Ƭ HMSNotificationCallback<T>: (notification: HMSNotificationInCallback<T>) => void

Type parameters

NameType
Textends HMSNotificationTypeParam

Type declaration

▸ (notification): void

Parameters
NameType
notificationHMSNotificationInCallback<T>
Returns

void


HMSNotificationInCallback

Ƭ HMSNotificationInCallback<T>: T extends HMSNotificationTypes[] ? MappedNotifications<T>[number] : T extends HMSNotificationTypes ? HMSNotificationMapping<T> : HMSNotification

Type parameters

NameType
Textends HMSNotificationTypeParam

HMSNotificationMapping

Ƭ HMSNotificationMapping<T, C>: { CHANGE_MULTI_TRACK_STATE_REQUEST: HMSChangeMultiTrackStateRequestNotification ; CHANGE_TRACK_STATE_REQUEST: HMSChangeTrackStateRequestNotification ; DEVICE_CHANGE_UPDATE: HMSDeviceChangeEventNotification ; ERROR: HMSExceptionNotification ; HAND_RAISE_CHANGED: HMSPeerNotification ; METADATA_UPDATED: HMSPeerNotification ; NAME_UPDATED: HMSPeerNotification ; NEW_MESSAGE: HMSMessageNotification ; PEER_JOINED: HMSPeerNotification ; PEER_LEFT: HMSPeerNotification ; PEER_LIST: HMSPeerListNotification ; PLAYLIST_TRACK_ENDED: HMSPlaylistItemNotification<C> ; POLLS_LIST: HMSPollNotification ; POLL_CREATED: HMSPollNotification ; POLL_STARTED: HMSPollNotification ; POLL_STOPPED: HMSPollNotification ; POLL_VOTES_UPDATED: HMSPollNotification ; RECONNECTED: HMSReconnectionNotification ; RECONNECTING: HMSReconnectionNotification ; REMOVED_FROM_ROOM: HMSLeaveRoomRequestNotification ; ROLE_UPDATED: HMSPeerNotification ; ROOM_ENDED: HMSLeaveRoomRequestNotification ; TRACK_ADDED: HMSTrackNotification ; TRACK_DEGRADED: HMSTrackNotification ; TRACK_DESCRIPTION_CHANGED: HMSTrackNotification ; TRACK_MUTED: HMSTrackNotification ; TRACK_REMOVED: HMSTrackNotification ; TRACK_RESTORED: HMSTrackNotification ; TRACK_UNMUTED: HMSTrackNotification }[T]

Type parameters

NameType
Textends HMSNotificationTypes
Cany

HMSNotificationTypeParam

Ƭ HMSNotificationTypeParam: HMSNotificationTypes | HMSNotificationTypes[] | undefined


HMSPeerID

Ƭ HMSPeerID: string


HMSPollState

Ƭ HMSPollState: "created" | "started" | "stopped"


HMSPreferredSimulcastLayer

Ƭ HMSPreferredSimulcastLayer: Exclude<HMSSimulcastLayer, NONE>


HMSRoleName

Ƭ HMSRoleName: string


HMSRoomID

Ƭ HMSRoomID: string


HMSTrack

Ƭ HMSTrack: HMSVideoTrack | HMSAudioTrack | HMSScreenVideoTrack | HMSScreenAudioTrack


HMSTrackDisplaySurface

Ƭ HMSTrackDisplaySurface: "application" | "browser" | "selfBrowser" | "monitor" | "window"

Use this to identify what is being screenshared, not all browsers will support everything.

application - all windows of an application are shared window - a particular window is being shared monitor - full screen share of a monitor display browser - a browser tab is shared selfBrowser - the current browser tab is being shared


HMSTrackFacingMode

Ƭ HMSTrackFacingMode: "user" | "environment" | "left" | "right"


HMSTrackID

Ƭ HMSTrackID: string


HMSTrackSource

Ƭ HMSTrackSource: "regular" | "screen" | "plugin" | "audioplaylist" | "videoplaylist" | string


HMSTrackType

Ƭ HMSTrackType: "audio" | "video"


MappedNotifications

Ƭ MappedNotifications<Type>: { [index in keyof Type]: HMSNotificationMapping<Type[index]> }

Type parameters

NameType
Typeextends HMSNotificationTypes[]

RID

Ƭ RID: "f" | "h" | "q"

Variables

parsedUserAgent

Const parsedUserAgent: UAParserInstance


selectAudioPlaylist

Const selectAudioPlaylist: HMSPlaylistSelector


selectHMSStats

Const selectHMSStats: Object

Type declaration

NameType
availablePublishBitrateOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
availableSubscribeBitrateOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
jitterOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
localAudioTrackStatsOutputSelector<HMSStatsStore, undefined | HMSTrackStats, (res1: Record<string, undefined | HMSTrackStats[]>, res2: undefined | string) => undefined | HMSTrackStats>
localAudioTrackStatsByID(id?: string) => StoreSelector<HMSStatsStore, undefined | HMSTrackStats>
localPeerStatsOutputSelector<HMSStatsStore, undefined | HMSPeerStats, (res1: Record<string, undefined | HMSPeerStats>, res2: string) => undefined | HMSPeerStats>
localVideoTrackStatsOutputSelector<HMSStatsStore, undefined | HMSTrackStats, (res1: Record<string, undefined | HMSTrackStats[]>, res2: undefined | string) => undefined | HMSTrackStats>
localVideoTrackStatsByID(id?: string) => StoreSelector<HMSStatsStore, undefined | HMSTrackStats[]>
localVideoTrackStatsByLayer(layer?: HMSPreferredSimulcastLayer) => (id?: string) => StoreSelector<HMSStatsStore, undefined | HMSTrackStats>
packetsLostOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
peerStatsByID(id?: string) => StoreSelector<HMSStatsStore, undefined | HMSPeerStats>
publishBitrateOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
subscribeBitrateOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
totalBytesReceivedOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
totalBytesSentOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
trackStatsByID(id?: string) => StoreSelector<HMSStatsStore, undefined | HMSTrackStats>

selectVideoPlaylist

Const selectVideoPlaylist: HMSPlaylistSelector


simulcastMapping

Const simulcastMapping: Object

Type declaration

Functions

createDefaultStatsStore

createDefaultStatsStore(): HMSStatsStore

Returns

HMSStatsStore


selectAppData

selectAppData(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, any>

Select a particular key from ui app data by passed in key. if key is not passed, full data is returned.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, any>


selectAppDataByPath

selectAppDataByPath(...keys): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | Record<string, any>, (res: undefined | Record<string, any>) => undefined | Record<string, any>>

Parameters

NameType
...keysstring[]

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | Record<string, any>, (res: undefined | Record<string, any>) => undefined | Record<string, any>>


selectAudioPlaylistTrackByPeerID

selectAudioPlaylistTrackByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>


selectAudioTrackByID

selectAudioTrackByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSAudioTrack>

Select the HMSAudioTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSAudioTrack>


selectAudioTrackByPeerID

selectAudioTrackByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>

Select the primary audio track of a peer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>


selectAudioTrackVolume

selectAudioTrackVolume(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | number>

Select the local audio volume of an audio track given a track ID.

NOTE: Volume of a track is different from Audio Level of a track,

  • Audio Level measures the audio of a track and it comes from 100ms's servers.
  • Volume is how loud you hear the audio of a track, this is controlled by you at the client side.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | number>


selectAudioVolumeByPeerID

selectAudioVolumeByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | number>

Select the local audio volume of the primary audio track of a peer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | number>


selectAuxiliaryAudioByPeerID

selectAuxiliaryAudioByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>

Select the first auxiliary audio track of a peer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>


selectAuxiliaryTracksByPeerID

selectAuxiliaryTracksByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSTrack[]>

Select an array of auxiliary tracks of a peer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSTrack[]>


selectAvailableRoleNames

selectAvailableRoleNames(state): string[]

Select an array of names of available roles in the room.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

string[]


selectBroadcastMessages

selectBroadcastMessages(state): HMSMessage[]

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSMessage[]


selectBroadcastMessagesUnreadCount

selectBroadcastMessagesUnreadCount(state): number

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

number


selectCameraStreamByPeerID

selectCameraStreamByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSVideoTrack>

Select the camera stream of a peer given a peer ID. This is the primary video track of a peer.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSVideoTrack>


selectConnectionQualities

selectConnectionQualities(store): Record<string, HMSConnectionQuality>

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

Record<string, HMSConnectionQuality>


selectConnectionQualityByPeerID

selectConnectionQualityByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSConnectionQuality>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSConnectionQuality>


selectDegradedTracks

selectDegradedTracks(state): HMSVideoTrack[]

Select an array of tracks that have been degraded(receiving lower video quality/no video) due to bad network locally.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSVideoTrack[]


selectDevices

selectDevices(store): DeviceMap

Select the available audio input, audio output and video input devices on your machine.

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

DeviceMap

An object of array of available audio input, audio output and video input devices.

type DeviceMap = { audioInput: InputDeviceInfo[]; audioOutput: MediaDeviceInfo[]; videoInput: InputDeviceInfo[]; }

selectDidIJoinWithin

selectDidIJoinWithin(timeMs): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean, (res: HMSRoom) => undefined | boolean>

Returns a boolean to indicate if the local peer joined within the past timeMs milliseconds.

Ex: to know if the local peer joined within the last one second

const joinedWithinASecond = useHMSStore(selectDidIJoinWithin(1000));

Parameters

NameType
timeMsnumber

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean, (res: HMSRoom) => undefined | boolean>


selectDominantSpeaker

selectDominantSpeaker(state): null | HMSPeer

Select the peer who's speaking the loudest at the moment

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

null | HMSPeer


selectEffectsKey

selectEffectsKey(state): undefined | string

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | string


selectErrors

selectErrors(store): HMSException[]

Select the current [] object to monitor the error logs

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSException[]


selectHLSState

selectHLSState(state): HMSHLS

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSHLS


selectHMSBroadcastMessages

selectHMSBroadcastMessages(state): HMSMessage[]

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSMessage[]


selectHMSMessages

selectHMSMessages(state): HMSMessage[]

Select an array of messages in the room(sent and received).

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSMessage[]


selectHMSMessagesCount

selectHMSMessagesCount(state): number

Select the number of messages(sent and received).

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

number


selectHandRaisedPeers

selectHandRaisedPeers(state): HMSPeer[]

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPeer[]


selectHasPeerHandRaised

selectHasPeerHandRaised(peerId): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean, (res: null | HMSPeer) => boolean>

Parameters

NameType
peerIdstring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean, (res: null | HMSPeer) => boolean>


selectIsAllowedToPreviewMedia

selectIsAllowedToPreviewMedia(state): HMSPublishAllowed

Select what streams is the local peer allowed to preview from video, audio

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPublishAllowed


selectIsAllowedToPublish

selectIsAllowedToPublish(state): HMSPublishAllowed

Select what streams is the local peer allowed to publish from video, audio and screenshare.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPublishAllowed


selectIsAllowedToSubscribe

selectIsAllowedToSubscribe(state): boolean

Select a boolean denoting whether if your local peer is allowed to subscribe to any other role.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectIsAudioLocallyMuted

selectIsAudioLocallyMuted(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean>

Select a boolean denoting whether you've muted an audio track locally(only for you) given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean>


selectIsConnectedToRoom

selectIsConnectedToRoom(state): undefined | boolean

Select a boolean flag denoting whether you've joined a room. NOTE: Returns true only after join, returns false during preview.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | boolean


selectIsEffectsEnabled

selectIsEffectsEnabled(state): boolean

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectIsInPreview

selectIsInPreview(state): boolean

Select a boolean denoting whether the room is in Preview state.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectIsLargeRoom

selectIsLargeRoom(state): boolean

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectIsLocalAudioEnabled

selectIsLocalAudioEnabled(store): boolean

Select a boolean denoting whether your local audio is unmuted and the audio from your microphone is shared to remote peers

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectIsLocalAudioPluginPresent

selectIsLocalAudioPluginPresent(pluginName): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean, (res: string[]) => boolean>

Parameters

NameType
pluginNamestring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean, (res: string[]) => boolean>


selectIsLocalScreenShared

selectIsLocalScreenShared(state): boolean

Select a boolean denoting whether your screen is shared to remote peers in the room.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectIsLocalVideoDisplayEnabled

selectIsLocalVideoDisplayEnabled(store): undefined | boolean

Select a boolean denoting whether you've chosen to unmute and share your local video.

NOTE: Once you call hmsActions.setLocalVideoEnabled(true)to unmute your local video, it takes some time to fetch your video from your video source. This displayEnabled property gives immediate feedback for a more interactive UI, without waiting for the video source

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | boolean


selectIsLocalVideoEnabled

selectIsLocalVideoEnabled(store): boolean

Select a boolean denoting whether your local video is unmuted and the video from your camera is shared to remote peers

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectIsLocalVideoPluginPresent

selectIsLocalVideoPluginPresent(pluginName): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean, (res: string[]) => boolean>

Parameters

NameType
pluginNamestring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean, (res: string[]) => boolean>


selectIsLocallyMutedByPeerID

selectIsLocallyMutedByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean>

Select a boolean denoting whether you've muted the primary audio track of a peer locally(only for you) given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean>


selectIsPeerAudioEnabled

selectIsPeerAudioEnabled(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean>

Select a boolean denoting whether a peer has unmuted audio and sharing it to other peers.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean>


selectIsPeerVideoEnabled

selectIsPeerVideoEnabled(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean>

Select a boolean denoting whether a peer has unmuted video and sharing it to other peers.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, boolean>


selectIsRoleAllowedToPublish

selectIsRoleAllowedToPublish(roleName): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPublishAllowed, (res: HMSRole) => HMSPublishAllowed>

Parameters

NameType
roleNamestring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPublishAllowed, (res: HMSRole) => HMSPublishAllowed>


selectIsScreenShareLocallyMutedByPeerID

selectIsScreenShareLocallyMutedByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean>

Select a boolean denoting whether you've muted the screen share audio track of a peer locally(only for you) given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | boolean>


selectIsSomeoneScreenSharing

selectIsSomeoneScreenSharing(state): boolean

Select a boolean denoting whether someone is sharing screen in the room.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectLocalAudioTrackID

selectLocalAudioTrackID(state): undefined | string

Select the track ID of your local peer's primary audio track

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | string


selectLocalMediaSettings

selectLocalMediaSettings(store): HMSMediaSettings

Select your media settings i.e., choosen audio input device, audio output device and video input device.

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSMediaSettings


selectLocalPeer

selectLocalPeer(state): undefined | HMSPeer

Select the local peer object object assigned to you.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | HMSPeer


selectLocalPeerID

selectLocalPeerID(state): string

Select the peer ID of your local peer.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

string


selectLocalPeerName

selectLocalPeerName(state): undefined | string

Select the peer name of your local peer.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | string


selectLocalPeerRole

selectLocalPeerRole(state): null | HMSRole

Select the HMSRole object of your local peer.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

null | HMSRole


selectLocalPeerRoleName

selectLocalPeerRoleName(state): undefined | string

Select the role name of your local peer.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | string


selectLocalTrackIDs

selectLocalTrackIDs(state): string[]

Select an array of track IDs of all your local peer's tracks

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

string[]


selectLocalVideoTrackID

selectLocalVideoTrackID(state): undefined | string

Select the track ID of your local peer's primary video track

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | string


selectMessageByMessageID

selectMessageByMessageID(id): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSMessage, (res: Record<string, HMSMessage>) => HMSMessage>

Parameters

NameType
idstring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSMessage, (res: Record<string, HMSMessage>) => HMSMessage>


selectMessageIDsInOrder

selectMessageIDsInOrder(store): string[]

Select IDs of messages you've sent or received sorted chronologically.

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

string[]


selectMessagesByPeerID

selectMessagesByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSMessage[]>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSMessage[]>


selectMessagesByRole

selectMessagesByRole(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSMessage[]>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSMessage[]>


selectMessagesUnreadCountByPeerID

selectMessagesUnreadCountByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>


selectMessagesUnreadCountByRole

selectMessagesUnreadCountByRole(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>


selectPeerAudioByID

selectPeerAudioByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>

Select audio level of audioTrack of a peer given a peer IDß.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>


selectPeerByCondition

selectPeerByCondition(predicate): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSPeer, (res: HMSPeer[]) => undefined | HMSPeer>

Selects the first peer passing the condition given by the argument predicate function

Ex: to select a peer whose metadata has spotlight set to true(assuming peer.metadata is a valid json string), use

const spotlightPeer = useHMSStore(selectPeerByCondition(peer => JSON.parse(peer.metadata).spotlight));

Parameters

NameType
predicate(peer: HMSPeer) => boolean

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSPeer, (res: HMSPeer[]) => undefined | HMSPeer>


selectPeerByID

selectPeerByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSPeer>

Select the HMSPeer object given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSPeer>


selectPeerCount

selectPeerCount(state): number

selectPeerCount gives the number of peers Inside the room. This doesn't count the local peer if they're still in preview and haven't yet joined the room. Note that this will not necessarily equal the number of peers received through selectPeers, it's possible to know total number of people in the room without having details of everyone depending on dashboard settings.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

number


selectPeerMetadata

selectPeerMetadata(peerId): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, any, (res: null | HMSPeer) => any>

Selects the peer metadata for the passed in peer and returns it as JSON. If metadata is not present or conversion to JSON gives an error, an empty object is returned. Please directly use peer.metadata in case the metadata is not JSON by design.

Parameters

NameType
peerIdstring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, any, (res: null | HMSPeer) => any>


selectPeerName

selectPeerName(peerId): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | string, (res: null | HMSPeer) => undefined | string>

Parameters

NameType
peerIdstring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | string, (res: null | HMSPeer) => undefined | string>


selectPeerNameByID

selectPeerNameByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | string>

Select the name of a HMSPeer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | string>


selectPeerScreenSharing

selectPeerScreenSharing(state): undefined | HMSPeer

Select the first peer who is currently sharing their screen.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | HMSPeer


selectPeerSharingAudio

selectPeerSharingAudio(state): undefined | HMSPeer

Select the first peer who is currently sharing their audio only screen

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | HMSPeer


selectPeerSharingAudioPlaylist

selectPeerSharingAudioPlaylist(state): undefined | HMSPeer

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | HMSPeer


selectPeerSharingVideoPlaylist

selectPeerSharingVideoPlaylist(state): undefined | HMSPeer

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | HMSPeer


selectPeers

selectPeers(state): HMSPeer[]

Select an array of peers(remote peers and your local peer) present in the room.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPeer[]


selectPeersByCondition

selectPeersByCondition(predicate): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>

Selects all peers passing the condition given by the argument predicate function

Ex: to select peers with isHandRaised set to true in their metadata(assuming peer.metadata is a valid json string), use

const handRaisedPeers = useHMSStore(selectPeersByCondition(peer => JSON.parse(peer.metadata).isHandRaised));

Parameters

NameType
predicate(peer: HMSPeer) => boolean

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>


selectPeersByRole

selectPeersByRole(role): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>

Select an array of peers of a particular role

Parameters

NameTypeDescription
rolestringHMSRoleName

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>

HMSPeer[]


selectPeersByRoles

selectPeersByRoles(roles): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>

Select an array of peers of a particular role

Parameters

NameTypeDescription
rolesstring[]HMSRoleName[]

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>

HMSPeer[]


selectPeersScreenSharing

selectPeersScreenSharing(state): HMSPeer[]

Select an array of peers who are currently sharing their screen.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPeer[]


selectPeersWithAudioStatus

selectPeersWithAudioStatus(state): HMSPeerWithMuteStatus[]

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPeerWithMuteStatus[]


selectPermissions

selectPermissions(state): undefined | { browserRecording: boolean ; changeRole: boolean ; endRoom: boolean ; hlsStreaming: boolean ; mute: boolean ; pollRead: boolean ; pollWrite: boolean ; removeOthers: boolean ; rtmpStreaming: boolean ; unmute: boolean ; whiteboard?: HMSPermissionType[] }

Select the permissions which determine what actions the local peer can do.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | { browserRecording: boolean ; changeRole: boolean ; endRoom: boolean ; hlsStreaming: boolean ; mute: boolean ; pollRead: boolean ; pollWrite: boolean ; removeOthers: boolean ; rtmpStreaming: boolean ; unmute: boolean ; whiteboard?: HMSPermissionType[] }


selectPollByID

selectPollByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSPoll>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSPoll>


selectPolls

selectPolls(store): HMSPoll[]

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPoll[]


selectPollsMap

selectPollsMap(store): Record<string, HMSPoll>

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

Record<string, HMSPoll>


selectPreviewRole

selectPreviewRole(state): null | HMSRole

Select the HMSRole used for preview.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

null | HMSRole


selectPreviewRoleName

selectPreviewRoleName(store): undefined | string

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | string


selectRTMPState

selectRTMPState(state): HMSRTMP

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSRTMP


selectRecentError

selectRecentError(state): undefined | null | HMSException

It will help to get the all the error

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | null | HMSException


selectRecordingState

selectRecordingState(state): HMSRecording

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSRecording


selectRemotePeers

selectRemotePeers(state): HMSPeer[]

Select remote peers(other users you're connected with via the internet) present in the room.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSPeer[]


selectRoleByRoleName

selectRoleByRoleName(roleName): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSRole, (res: Record<string, HMSRole>) => HMSRole>

Parameters

NameType
roleNamestring

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSRole, (res: Record<string, HMSRole>) => HMSRole>


selectRoleChangeRequest

selectRoleChangeRequest(state): null | HMSRoleChangeRequest

Select the role change request received for your local peer.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

null | HMSRoleChangeRequest


selectRolesMap

selectRolesMap(store): Record<string, HMSRole>

Select available roles in the room as a map between the role name and HMSRole object.

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

Record<string, HMSRole>


selectRoom

selectRoom(store): HMSRoom

Select the current HMSRoom object to which you are connected.

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSRoom


selectRoomID

selectRoomID(state): string

Select the ID of the current room to which you are connected.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

string


selectRoomStartTime

selectRoomStartTime(state): undefined | Date

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | Date


selectRoomStarted

selectRoomStarted(state): boolean

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

boolean


selectRoomState

selectRoomState(state): HMSRoomState

Select the current state of the room.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

HMSRoomState


selectScreenAudioTrackByID

selectScreenAudioTrackByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSAudioTrack>

Select the HMSScreenAudioTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSAudioTrack>


selectScreenShareAudioByPeerID

selectScreenShareAudioByPeerID(id?): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSScreenAudioTrack, (res: { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }) => HMSScreenAudioTrack>

Select the screen share audio track of a peer given a peer ID.

Parameters

NameType
id?string

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSScreenAudioTrack, (res: { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }) => HMSScreenAudioTrack>


selectScreenShareByPeerID

selectScreenShareByPeerID(id?): OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSScreenVideoTrack, (res: { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }) => HMSScreenVideoTrack>

Select the screen share video track of a peer given a peer ID.

Parameters

NameType
id?string

Returns

OutputSelector<HMSStore<{ sessionStore: Record<string, any> }>, HMSScreenVideoTrack, (res: { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }) => HMSScreenVideoTrack>


selectScreenSharesByPeerId

selectScreenSharesByPeerId(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }>


selectScreenVideoTrackByID

selectScreenVideoTrackByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSScreenVideoTrack>

Select the HMSScreenVideoTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSScreenVideoTrack>


selectScreenshareAudioVolumeByPeerID

selectScreenshareAudioVolumeByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | number>

Select the local audio volume of the screen share of a peer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | number>


selectSessionId

selectSessionId(state): string

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

string


selectSessionMetadata

selectSessionMetadata(store): any

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

any

Deprecated

  • use selectSessionStore instead

selectSessionStore

selectSessionStore<T>(): (store: HMSStore<T>) => T["sessionStore"] | undefined

Select a particular key from session store by passed in key. if key is not passed, full data is returned.

Type parameters

NameType
Textends HMSGenericTypes = { sessionStore: Record<string, any> }

Returns

fn

▸ (store): T["sessionStore"] | undefined

Parameters
NameType
storeHMSStore<T>
Returns

T["sessionStore"] | undefined

selectSessionStore<T, K>(key): (store: HMSStore<T>) => T["sessionStore"][K] | undefined

Type parameters

NameType
Textends HMSGenericTypes = { sessionStore: Record<string, any> }
Kextends string | number | symbol = keyof T["sessionStore"]

Parameters

NameType
keyK

Returns

fn

▸ (store): T["sessionStore"][K] | undefined

Parameters
NameType
storeHMSStore<T>
Returns

T["sessionStore"][K] | undefined


selectSimulcastLayerByTrack

selectSimulcastLayerByTrack(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSSimulcastLayer>

Select the current simulcast layer of a track given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSSimulcastLayer>


selectSpeakers

selectSpeakers(store): Record<string, HMSSpeaker>

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

Record<string, HMSSpeaker>


selectTemplateAppData

selectTemplateAppData(store): Record<string, string>

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

Record<string, string>


selectTrackAudioByID

selectTrackAudioByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>

Select the audio level of a track given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, number>


selectTrackByID

selectTrackByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSAudioTrack | HMSVideoTrack | HMSScreenVideoTrack>

Select the HMSTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSAudioTrack | HMSVideoTrack | HMSScreenVideoTrack>


selectUnreadHMSBroadcastMessagesCount

selectUnreadHMSBroadcastMessagesCount(state): number

Select the number of unread broadcast messages

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

number


selectUnreadHMSMessagesCount

selectUnreadHMSMessagesCount(state): number

Select the number of unread messages.

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

number


selectVideoPlaylistAudioTrackByPeerID

selectVideoPlaylistAudioTrackByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSAudioTrack>


selectVideoPlaylistVideoTrackByPeerID

selectVideoPlaylistVideoTrackByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSVideoTrack>

takes in a normal selector which has store and id as input and curries it to make it easier to use. Before: store.getState((store) => normalSelector(store, peerID)) After: store.getState(curriedSelector(peerID))

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSVideoTrack>


selectVideoTrackByID

selectVideoTrackByID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSVideoTrack>

Select the HMSVideoTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, null | HMSVideoTrack>


selectVideoTrackByPeerID

selectVideoTrackByPeerID(id?): StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSVideoTrack>

Select the primary video track of a peer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore<{ sessionStore: Record<string, any> }>, undefined | HMSVideoTrack>


selectWhiteboard

selectWhiteboard(state): undefined | HMSWhiteboard

select the primary/first whiteboard of a session

Parameters

NameType
stateHMSStore<{ sessionStore: Record<string, any> }>

Returns

undefined | HMSWhiteboard


selectWhiteboards

selectWhiteboards(store): Record<string, HMSWhiteboard>

select a map of all the whiteboards in the session

Parameters

NameType
storeHMSStore<{ sessionStore: Record<string, any> }>

Returns

Record<string, HMSWhiteboard>


Have a suggestion? Recommend changes ->

Was this helpful?

1234