100ms Logo

100ms

Docs

Search docs
/

Web SDK API Reference

Enumerations

Classes

Core Interfaces

Other Interfaces

References

IHMSNotifications

Renames and re-exports HMSNotifications

Type Aliases

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 ; METADATA_UPDATED: HMSPeerNotification ; NAME_UPDATED: HMSPeerNotification ; NEW_MESSAGE: HMSMessageNotification ; PEER_JOINED: HMSPeerNotification ; PEER_LEFT: HMSPeerNotification ; PEER_LIST: HMSPeerListNotification ; PLAYLIST_TRACK_ENDED: HMSPlaylistItemNotification<C> ; 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


HMSRoleName

Ƭ HMSRoleName: string


HMSRoomID

Ƭ HMSRoomID: string


HMSTrack

Ƭ HMSTrack: HMSVideoTrack | HMSAudioTrack | HMSScreenVideoTrack | HMSScreenAudioTrack


HMSTrackDisplaySurface

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


HMSTrackFacingMode

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


HMSTrackID

Ƭ HMSTrackID: string


HMSTrackSource

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


HMSTrackType

Ƭ HMSTrackType: "audio" | "video"

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>
bitrateByTrackID(id?: string) => StoreSelector<HMSStatsStore, undefined | number>
bytesReceivedByTrackID(id?: string) => StoreSelector<HMSStatsStore, undefined | number>
framerateByTrackID(id?: string) => StoreSelector<HMSStatsStore, undefined | number>
jitterOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
jitterByTrackID(id?: string) => StoreSelector<HMSStatsStore, undefined | number>
localAudioTrackBitrateOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number>
localAudioTrackBytesSentOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number>
localAudioTrackStatsOutputSelector<HMSStatsStore, undefined | HMSLocalTrackStats, (res1: Record<string, undefined | HMSTrackStats>, res2: undefined | string) => undefined | HMSLocalTrackStats>
localPeerStatsOutputSelector<HMSStatsStore, undefined | HMSPeerStats, (res1: Record<string, undefined | HMSPeerStats>, res2: string) => undefined | HMSPeerStats>
localVideoTrackBitrateOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number>
localVideoTrackBytesSentOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number>
localVideoTrackFramerateOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number>
localVideoTrackQualityLimitationReasonOutputSelector<HMSStatsStore, undefined | string, (res: undefined | HMSLocalTrackStats) => undefined | string>
localVideoTrackStatsOutputSelector<HMSStatsStore, undefined | HMSLocalTrackStats, (res1: Record<string, undefined | HMSTrackStats>, res2: undefined | string) => undefined | HMSLocalTrackStats>
packetsLostOutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number>
packetsLostByTrackID(id?: string) => StoreSelector<HMSStatsStore, 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

Functions

createDefaultStatsStore

createDefaultStatsStore(): HMSStatsStore

Returns

HMSStatsStore


selectAppData

selectAppData(id?): StoreSelector<HMSStore, 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, any>


selectAppDataByPath

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

Parameters

NameType
...keysstring[]

Returns

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


selectAudioPlaylistTrackByPeerID

selectAudioPlaylistTrackByPeerID(id?): StoreSelector<HMSStore, 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, undefined | HMSAudioTrack>


selectAudioTrackByID

selectAudioTrackByID(id?): StoreSelector<HMSStore, null | HMSAudioTrack>

Select the HMSAudioTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, null | HMSAudioTrack>


selectAudioTrackByPeerID

selectAudioTrackByPeerID(id?): StoreSelector<HMSStore, undefined | HMSAudioTrack>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, undefined | HMSAudioTrack>


selectAudioTrackVolume

selectAudioTrackVolume(id?): StoreSelector<HMSStore, 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, undefined | number>


selectAudioVolumeByPeerID

selectAudioVolumeByPeerID(id?): StoreSelector<HMSStore, 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, undefined | number>


selectAuxiliaryAudioByPeerID

selectAuxiliaryAudioByPeerID(id?): StoreSelector<HMSStore, undefined | HMSAudioTrack>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, undefined | HMSAudioTrack>


selectAuxiliaryTracksByPeerID

selectAuxiliaryTracksByPeerID(id?): StoreSelector<HMSStore, HMSTrack[]>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, HMSTrack[]>


selectAvailableRoleNames

selectAvailableRoleNames(state): string[]

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

Parameters

NameType
stateHMSStore

Returns

string[]


selectBroadcastMessages

selectBroadcastMessages(state): HMSMessage[]

Parameters

NameType
stateHMSStore

Returns

HMSMessage[]


selectBroadcastMessagesUnreadCount

selectBroadcastMessagesUnreadCount(state): number

Parameters

NameType
stateHMSStore

Returns

number


selectCameraStreamByPeerID

selectCameraStreamByPeerID(id?): StoreSelector<HMSStore, 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, undefined | HMSVideoTrack>


selectConnectionQualities

selectConnectionQualities(store): Record<string, HMSConnectionQuality>

Parameters

NameType
storeHMSStore

Returns

Record<string, HMSConnectionQuality>


selectConnectionQualityByPeerID

selectConnectionQualityByPeerID(id?): StoreSelector<HMSStore, 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, 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

Returns

HMSVideoTrack[]


selectDevices

selectDevices(store): DeviceMap

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

Parameters

NameType
storeHMSStore

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, 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, 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

Returns

null | HMSPeer


selectHLSState

selectHLSState(state): HMSHLS

Parameters

NameType
stateHMSStore

Returns

HMSHLS


selectHMSMessages

selectHMSMessages(state): HMSMessage[]

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

Parameters

NameType
stateHMSStore

Returns

HMSMessage[]


selectHMSMessagesCount

selectHMSMessagesCount(state): number

Select the number of messages(sent and received).

Parameters

NameType
stateHMSStore

Returns

number


selectIsAllowedToPublish

selectIsAllowedToPublish(state): HMSPublishAllowed

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

Parameters

NameType
stateHMSStore

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

Returns

boolean


selectIsAudioLocallyMuted

selectIsAudioLocallyMuted(id?): StoreSelector<HMSStore, 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, 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

Returns

undefined | boolean


selectIsInPreview

selectIsInPreview(state): boolean

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

Parameters

NameType
stateHMSStore

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

Returns

boolean


selectIsLocalAudioPluginPresent

selectIsLocalAudioPluginPresent(pluginName): OutputSelector<HMSStore, boolean, (res: string[]) => boolean>

Parameters

NameType
pluginNamestring

Returns

OutputSelector<HMSStore, 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

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

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

Returns

boolean


selectIsLocalVideoPluginPresent

selectIsLocalVideoPluginPresent(pluginName): OutputSelector<HMSStore, boolean, (res: string[]) => boolean>

Parameters

NameType
pluginNamestring

Returns

OutputSelector<HMSStore, boolean, (res: string[]) => boolean>


selectIsLocallyMutedByPeerID

selectIsLocallyMutedByPeerID(id?): StoreSelector<HMSStore, 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, undefined | boolean>


selectIsPeerAudioEnabled

selectIsPeerAudioEnabled(id?): StoreSelector<HMSStore, boolean>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, boolean>


selectIsPeerVideoEnabled

selectIsPeerVideoEnabled(id?): StoreSelector<HMSStore, boolean>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, boolean>


selectIsScreenShareLocallyMutedByPeerID

selectIsScreenShareLocallyMutedByPeerID(id?): StoreSelector<HMSStore, 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, undefined | boolean>


selectIsSomeoneScreenSharing

selectIsSomeoneScreenSharing(state): boolean

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

Parameters

NameType
stateHMSStore

Returns

boolean


selectLocalAudioTrackID

selectLocalAudioTrackID(state): undefined | string

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

Parameters

NameType
stateHMSStore

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

Returns

HMSMediaSettings


selectLocalPeer

selectLocalPeer(state): HMSPeer

Select the local peer object object assigned to you.

Parameters

NameType
stateHMSStore

Returns

HMSPeer


selectLocalPeerID

selectLocalPeerID(state): string

Select the peer ID of your local peer.

Parameters

NameType
stateHMSStore

Returns

string


selectLocalPeerName

selectLocalPeerName(state): string

Select the peer name of your local peer.

Parameters

NameType
stateHMSStore

Returns

string


selectLocalPeerRole

selectLocalPeerRole(state): null | HMSRole

Select the HMSRole object of your local peer.

Parameters

NameType
stateHMSStore

Returns

null | HMSRole


selectLocalPeerRoleName

selectLocalPeerRoleName(state): undefined | string

Select the role name of your local peer.

Parameters

NameType
stateHMSStore

Returns

undefined | string


selectLocalTrackIDs

selectLocalTrackIDs(state): string[]

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

Parameters

NameType
stateHMSStore

Returns

string[]


selectLocalVideoTrackID

selectLocalVideoTrackID(state): undefined | string

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

Parameters

NameType
stateHMSStore

Returns

undefined | string


selectMessageIDsInOrder

selectMessageIDsInOrder(store): string[]

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

Parameters

NameType
storeHMSStore

Returns

string[]


selectMessagesByPeerID

selectMessagesByPeerID(id?): StoreSelector<HMSStore, 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, undefined | HMSMessage[]>


selectMessagesByRole

selectMessagesByRole(id?): StoreSelector<HMSStore, 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, undefined | HMSMessage[]>


selectMessagesUnreadCountByPeerID

selectMessagesUnreadCountByPeerID(id?): StoreSelector<HMSStore, 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, number>


selectMessagesUnreadCountByRole

selectMessagesUnreadCountByRole(id?): StoreSelector<HMSStore, 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, number>


selectPeerAudioByID

selectPeerAudioByID(id?): StoreSelector<HMSStore, number>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, number>


selectPeerByCondition

selectPeerByCondition(predicate): OutputSelector<HMSStore, 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, undefined | HMSPeer, (res: HMSPeer[]) => undefined | HMSPeer>


selectPeerByID

selectPeerByID(id?): StoreSelector<HMSStore, null | HMSPeer>

Select the HMSPeer object given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, 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

Returns

number


selectPeerMetadata

selectPeerMetadata(peerId): OutputSelector<HMSStore, 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, any, (res: null | HMSPeer) => any>


selectPeerName

selectPeerName(peerId): OutputSelector<HMSStore, undefined | string, (res: null | HMSPeer) => undefined | string>

Parameters

NameType
peerIdstring

Returns

OutputSelector<HMSStore, undefined | string, (res: null | HMSPeer) => undefined | string>


selectPeerNameByID

selectPeerNameByID(id?): StoreSelector<HMSStore, undefined | string>

Select the name of a HMSPeer given a peer ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, undefined | string>


selectPeerScreenSharing

selectPeerScreenSharing(state): undefined | HMSPeer

Select the first peer who is currently sharing their screen.

Parameters

NameType
stateHMSStore

Returns

undefined | HMSPeer


selectPeerSharingAudio

selectPeerSharingAudio(state): undefined | HMSPeer

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

Parameters

NameType
stateHMSStore

Returns

undefined | HMSPeer


selectPeerSharingAudioPlaylist

selectPeerSharingAudioPlaylist(state): undefined | HMSPeer

Parameters

NameType
stateHMSStore

Returns

undefined | HMSPeer


selectPeerSharingVideoPlaylist

selectPeerSharingVideoPlaylist(state): undefined | HMSPeer

Parameters

NameType
stateHMSStore

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

Returns

HMSPeer[]


selectPeersByCondition

selectPeersByCondition(predicate): OutputSelector<HMSStore, 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, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>


selectPeersByRole

selectPeersByRole(role): OutputSelector<HMSStore, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>

Select an array of peers of a particular role

Parameters

NameTypeDescription
rolestringHMSRoleName

Returns

OutputSelector<HMSStore, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>

HMSPeer[]


selectPeersScreenSharing

selectPeersScreenSharing(state): HMSPeer[]

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

Parameters

NameType
stateHMSStore

Returns

HMSPeer[]


selectPeersWithAudioStatus

selectPeersWithAudioStatus(state): HMSPeerWithMuteStatus[]

Parameters

NameType
stateHMSStore

Returns

HMSPeerWithMuteStatus[]


selectPermissions

selectPermissions(state): undefined | { browserRecording: boolean ; changeRole: boolean ; endRoom: boolean ; hlsStreaming: boolean ; mute: boolean ; removeOthers: boolean ; rtmpStreaming: boolean ; unmute: boolean }

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

Parameters

NameType
stateHMSStore

Returns

undefined | { browserRecording: boolean ; changeRole: boolean ; endRoom: boolean ; hlsStreaming: boolean ; mute: boolean ; removeOthers: boolean ; rtmpStreaming: boolean ; unmute: boolean }


selectRTMPState

selectRTMPState(state): HMSRTMP

Parameters

NameType
stateHMSStore

Returns

HMSRTMP


selectRecordingState

selectRecordingState(state): HMSRecording

Parameters

NameType
stateHMSStore

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

Returns

HMSPeer[]


selectRoleByRoleName

selectRoleByRoleName(roleName): OutputSelector<HMSStore, HMSRole, (res: Record<string, HMSRole>) => HMSRole>

Parameters

NameType
roleNamestring

Returns

OutputSelector<HMSStore, HMSRole, (res: Record<string, HMSRole>) => HMSRole>


selectRoleChangeRequest

selectRoleChangeRequest(state): null | HMSRoleChangeRequest

Select the role change request received for your local peer.

Parameters

NameType
stateHMSStore

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

Returns

Record<string, HMSRole>


selectRoom

selectRoom(store): HMSRoom

Select the current HMSRoom object to which you are connected.

Parameters

NameType
storeHMSStore

Returns

HMSRoom


selectRoomID

selectRoomID(state): string

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

Parameters

NameType
stateHMSStore

Returns

string


selectRoomStartTime

selectRoomStartTime(state): undefined | Date

Parameters

NameType
stateHMSStore

Returns

undefined | Date


selectRoomStarted

selectRoomStarted(state): boolean

Parameters

NameType
stateHMSStore

Returns

boolean


selectRoomState

selectRoomState(state): HMSRoomState

Select the current state of the room.

Parameters

NameType
stateHMSStore

Returns

HMSRoomState


selectScreenAudioTrackByID

selectScreenAudioTrackByID(id?): StoreSelector<HMSStore, null | HMSAudioTrack>

Select the HMSScreenAudioTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, null | HMSAudioTrack>


selectScreenShareAudioByPeerID

selectScreenShareAudioByPeerID(id?): OutputSelector<HMSStore, 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, HMSScreenAudioTrack, (res: { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }) => HMSScreenAudioTrack>


selectScreenShareByPeerID

selectScreenShareByPeerID(id?): OutputSelector<HMSStore, 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, HMSScreenVideoTrack, (res: { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }) => HMSScreenVideoTrack>


selectScreenSharesByPeerId

selectScreenSharesByPeerId(id?): StoreSelector<HMSStore, { 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, { audio: HMSScreenAudioTrack ; video: HMSScreenVideoTrack }>


selectScreenVideoTrackByID

selectScreenVideoTrackByID(id?): StoreSelector<HMSStore, null | HMSScreenVideoTrack>

Select the HMSScreenVideoTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, null | HMSScreenVideoTrack>


selectScreenshareAudioVolumeByPeerID

selectScreenshareAudioVolumeByPeerID(id?): StoreSelector<HMSStore, 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, undefined | number>


selectSessionId

selectSessionId(state): string

Parameters

NameType
stateHMSStore

Returns

string


selectSessionMetadata

selectSessionMetadata(store): any

Parameters

NameType
storeHMSStore

Returns

any


selectSimulcastLayerByTrack

selectSimulcastLayerByTrack(id?): StoreSelector<HMSStore, undefined | HMSSimulcastLayer>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, undefined | HMSSimulcastLayer>


selectSpeakers

selectSpeakers(store): Record<string, HMSSpeaker>

Parameters

NameType
storeHMSStore

Returns

Record<string, HMSSpeaker>


selectTrackAudioByID

selectTrackAudioByID(id?): StoreSelector<HMSStore, number>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, number>


selectTrackByID

selectTrackByID(id?): StoreSelector<HMSStore, null | HMSAudioTrack | HMSVideoTrack | HMSScreenVideoTrack>

Select the HMSTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, null | HMSAudioTrack | HMSVideoTrack | HMSScreenVideoTrack>


selectUnreadHMSMessagesCount

selectUnreadHMSMessagesCount(state): number

Select the number of unread messages.

Parameters

NameType
stateHMSStore

Returns

number


selectVideoPlaylistAudioTrackByPeerID

selectVideoPlaylistAudioTrackByPeerID(id?): StoreSelector<HMSStore, 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, undefined | HMSAudioTrack>


selectVideoPlaylistVideoTrackByPeerID

selectVideoPlaylistVideoTrackByPeerID(id?): StoreSelector<HMSStore, 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, undefined | HMSVideoTrack>


selectVideoTrackByID

selectVideoTrackByID(id?): StoreSelector<HMSStore, null | HMSVideoTrack>

Select the HMSVideoTrack object given a track ID.

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, null | HMSVideoTrack>


selectVideoTrackByPeerID

selectVideoTrackByPeerID(id?): StoreSelector<HMSStore, undefined | HMSVideoTrack>

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

Parameters

NameType
id?string

Returns

StoreSelector<HMSStore, undefined | HMSVideoTrack>