Web SDK API Reference
Enumerations
- HMSAudioPluginType
- HMSLogLevel
- HMSNotificationSeverity
- HMSNotificationTypes
- HMSPlaylistType
- HMSRoomState
- HMSSimulcastLayer
- HMSVideoPluginType
Classes
Core Interfaces
Other Interfaces
- DeviceMap
- HLSConfig
- HLSMeetingURLVariant
- HMSAudioTrackSettings
- HMSChangeMultiTrackStateParams
- HMSChangeMultiTrackStateRequest
- HMSChangeTrackStateRequest
- HMSConfig
- HMSConfigInitialSettings
- HMSDeviceChangeEvent
- HMSException
- HMSLeaveRoomRequest
- HMSLocalTrackStats
- HMSMediaSettings
- HMSMessage
- HMSNotification
- HMSPeer
- HMSPeerStats
- HMSPeerWithMuteStatus
- HMSPlaylist
- HMSPlaylistItem
- HMSPlaylistSelection
- HMSPlaylistSelector
- HMSPublishAllowed
- HMSRTMP
- HMSRecording
- HMSRemoteTrackStats
- HMSRole
- HMSRoleChangeRequest
- HMSRoleChangeStoreRequest
- HMSRoom
- HMSSpeaker
- HMSStatsStore
- HMSStatsStoreWrapper
- HMSStore
- HMSTrack
- HMSTrackStats
- HMSVideoTrackSettings
- IHMSPlaylistActions
- IHMSStatsStore
- IHMSStore
- RTMPRecordingConfig
- SimulcastLayerDefinition
Type aliases
HMSMessageID
Ƭ HMSMessageID: string
HMSNotificationCallback
Ƭ HMSNotificationCallback: (notification: HMSNotification) => void
Type declaration
▸ (notification): void
Parameters
| Name | Type |
|---|---|
notification | HMSNotification |
Returns
void
HMSPeerID
Ƭ HMSPeerID: string
HMSRoleName
Ƭ HMSRoleName: string
HMSRoomID
Ƭ HMSRoomID: string
HMSTrackDisplaySurface
Ƭ HMSTrackDisplaySurface: "application" | "browser" | "monitor" | "window"
HMSTrackID
Ƭ HMSTrackID: string
HMSTrackSource
Ƭ HMSTrackSource: "regular" | "screen" | "plugin" | "audioplaylist" | "videoplaylist" | string
HMSTrackType
Ƭ HMSTrackType: "audio" | "video"
Variables
parsedUserAgent
• Const parsedUserAgent: UAParserInstance
selectAudioPlaylist
• Const selectAudioPlaylist: HMSPlaylistSelector
selectAvailableRoleNames
• Const selectAvailableRoleNames: OutputSelector<HMSStore, string[], (res: Record<string, HMSRole>) => string[]>
Select an array of names of available roles in the room.
selectBroadcastMessages
• Const selectBroadcastMessages: OutputSelector<HMSStore, HMSMessage[], (res: HMSMessage[]) => HMSMessage[]>
selectBroadcastMessagesUnreadCount
• Const selectBroadcastMessagesUnreadCount: OutputSelector<HMSStore, number, (res: HMSMessage[]) => number>
selectDegradedTracks
• Const selectDegradedTracks: OutputSelector<HMSStore, HMSTrack[], (res: HMSTrack[]) => HMSTrack[]>
Select an array of tracks that have been degraded(receiving lower video quality/no video) due to bad network locally.
selectDominantSpeaker
• Const selectDominantSpeaker: OutputSelector<HMSStore, null | HMSPeer, (res1: Record<string, HMSPeer>, res2: Record<string, HMSSpeaker>) => null | HMSPeer>
Select the peer who's speaking the loudest at the moment
selectHLSState
• Const selectHLSState: OutputSelector<HMSStore, HMSHLS, (res: HMSRoom) => HMSHLS>
selectHMSMessages
• Const selectHMSMessages: OutputSelector<HMSStore, HMSMessage[], (res1: string[], res2: Record<string, HMSMessage>) => HMSMessage[]>
Select an array of messages in the room(sent and received).
selectHMSMessagesCount
• Const selectHMSMessagesCount: OutputSelector<HMSStore, number, (res: string[]) => number>
Select the number of messages(sent and received).
selectHMSStats
• Const selectHMSStats: Object
Type declaration
| Name | Type |
|---|---|
availablePublishBitrate | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number> |
availableSubscribeBitrate | OutputSelector<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> |
jitter | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number> |
jitterByTrackID | (id?: string) => StoreSelector<HMSStatsStore, undefined | number> |
localAudioTrackBitrate | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number> |
localAudioTrackBytesSent | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number> |
localAudioTrackStats | OutputSelector<HMSStatsStore, undefined | HMSLocalTrackStats, (res1: Record<string, undefined | HMSTrackStats>, res2: undefined | string) => undefined | HMSLocalTrackStats> |
localPeerStats | OutputSelector<HMSStatsStore, undefined | HMSPeerStats, (res1: Record<string, undefined | HMSPeerStats>, res2: string) => undefined | HMSPeerStats> |
localVideoTrackBitrate | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number> |
localVideoTrackBytesSent | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number> |
localVideoTrackFramerate | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSLocalTrackStats) => undefined | number> |
localVideoTrackQualityLimitationReason | OutputSelector<HMSStatsStore, undefined | string, (res: undefined | HMSLocalTrackStats) => undefined | string> |
localVideoTrackStats | OutputSelector<HMSStatsStore, undefined | HMSLocalTrackStats, (res1: Record<string, undefined | HMSTrackStats>, res2: undefined | string) => undefined | HMSLocalTrackStats> |
packetsLost | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number> |
packetsLostByTrackID | (id?: string) => StoreSelector<HMSStatsStore, undefined | number> |
peerStatsByID | (id?: string) => StoreSelector<HMSStatsStore, undefined | HMSPeerStats> |
publishBitrate | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number> |
subscribeBitrate | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number> |
totalBytesReceived | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number> |
totalBytesSent | OutputSelector<HMSStatsStore, undefined | number, (res: undefined | HMSPeerStats) => undefined | number> |
trackStatsByID | (id?: string) => StoreSelector<HMSStatsStore, undefined | HMSTrackStats> |
selectIsAllowedToPublish
• Const selectIsAllowedToPublish: OutputSelector<HMSStore, HMSPublishAllowed, (res: null | HMSRole) => HMSPublishAllowed>
Select what streams is the local peer allowed to publish from video, audio and screenshare.
selectIsAllowedToSubscribe
• Const selectIsAllowedToSubscribe: OutputSelector<HMSStore, boolean, (res: null | HMSRole) => boolean>
Select a boolean denoting whether if your local peer is allowed to subscribe to any other role.
selectIsConnectedToRoom
• Const selectIsConnectedToRoom: OutputSelector<HMSStore, undefined | boolean, (res: HMSRoom) => undefined | boolean>
Select a boolean flag denoting whether you've joined a room. NOTE: Returns true only after join, returns false during preview.
selectIsInPreview
• Const selectIsInPreview: OutputSelector<HMSStore, boolean, (res: HMSRoomState) => boolean>
Select a boolean denoting whether the room is in Preview state.
selectIsLocalScreenShared
• Const selectIsLocalScreenShared: OutputSelector<HMSStore, boolean, (res1: HMSPeer, res2: Record<string, HMSTrack>) => boolean>
Select a boolean denoting whether your screen is shared to remote peers in the room.
selectIsSomeoneScreenSharing
• Const selectIsSomeoneScreenSharing: OutputSelector<HMSStore, boolean, (res: undefined | HMSPeer) => boolean>
Select a boolean denoting whether someone is sharing screen in the room.
selectLocalAudioTrackID
• Const selectLocalAudioTrackID: OutputSelector<HMSStore, undefined | string, (res: HMSPeer) => undefined | string>
Select the track ID of your local peer's primary audio track
selectLocalPeer
• Const selectLocalPeer: OutputSelector<HMSStore, HMSPeer, (res1: HMSRoom, res2: Record<string, HMSPeer>) => HMSPeer>
Select the local peer object object assigned to you.
selectLocalPeerID
• Const selectLocalPeerID: OutputSelector<HMSStore, string, (res: HMSRoom) => string>
Select the peer ID of your local peer.
selectLocalPeerName
• Const selectLocalPeerName: OutputSelector<HMSStore, string, (res: HMSPeer) => string>
Select the peer name of your local peer.
selectLocalPeerRole
• Const selectLocalPeerRole: OutputSelector<HMSStore, null | HMSRole, (res1: HMSPeer, res2: Record<string, HMSRole>) => null | HMSRole>
Select the HMSRole object of your local peer.
selectLocalPeerRoleName
• Const selectLocalPeerRoleName: OutputSelector<HMSStore, undefined | string, (res: HMSPeer) => undefined | string>
Select the role name of your local peer.
selectLocalTrackIDs
• Const selectLocalTrackIDs: OutputSelector<HMSStore, string[], (res1: undefined | string, res2: undefined | string, res3: string[]) => string[]>
Select an array of track IDs of all your local peer's tracks
selectLocalVideoTrackID
• Const selectLocalVideoTrackID: OutputSelector<HMSStore, undefined | string, (res: HMSPeer) => undefined | string>
Select the track ID of your local peer's primary video track
selectPeerCount
• Const selectPeerCount: OutputSelector<HMSStore, number, (res1: undefined | boolean, res2: HMSRoom) => 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.
selectPeerScreenSharing
• Const selectPeerScreenSharing: OutputSelector<HMSStore, undefined | HMSPeer, (res1: Record<string, HMSPeer>, res2: Record<string, HMSTrack>) => undefined | HMSPeer>
Select the first peer who is currently sharing their screen.
selectPeerSharingAudio
• Const selectPeerSharingAudio: OutputSelector<HMSStore, undefined | HMSPeer, (res1: Record<string, HMSPeer>, res2: Record<string, HMSTrack>) => undefined | HMSPeer>
Select the first peer who is currently sharing their audio only screen
selectPeerSharingAudioPlaylist
• Const selectPeerSharingAudioPlaylist: OutputSelector<HMSStore, undefined | HMSPeer, (res1: Record<string, HMSPeer>, res2: Record<string, HMSTrack>) => undefined | HMSPeer>
selectPeerSharingVideoPlaylist
• Const selectPeerSharingVideoPlaylist: OutputSelector<HMSStore, undefined | HMSPeer, (res1: Record<string, HMSPeer>, res2: Record<string, HMSTrack>) => undefined | HMSPeer>
selectPeers
• Const selectPeers: OutputSelector<HMSStore, HMSPeer[], (res1: HMSRoom, res2: Record<string, HMSPeer>) => HMSPeer[]>
Select an array of peers(remote peers and your local peer) present in the room.
selectPeersScreenSharing
• Const selectPeersScreenSharing: OutputSelector<HMSStore, HMSPeer[], (res1: Record<string, HMSPeer>, res2: Record<string, HMSTrack>) => HMSPeer[]>
Select an array of peers who are currently sharing their screen.
selectPeersWithAudioStatus
• Const selectPeersWithAudioStatus: OutputSelector<HMSStore, HMSPeerWithMuteStatus[], (res1: Record<string, HMSPeer>, res2: Record<string, HMSTrack>) => HMSPeerWithMuteStatus[]>
selectPermissions
• Const selectPermissions: OutputSelector<HMSStore, undefined | { changeRole: boolean ; endRoom: boolean ; mute: boolean ; recording: boolean ; removeOthers: boolean ; streaming: boolean ; unmute: boolean }, (res: null | HMSRole) => undefined | { changeRole: boolean ; endRoom: boolean ; mute: boolean ; recording: boolean ; removeOthers: boolean ; streaming: boolean ; unmute: boolean }>
Select the permissions which determine what actions the local peer can do.
selectRTMPState
• Const selectRTMPState: OutputSelector<HMSStore, HMSRTMP, (res: HMSRoom) => HMSRTMP>
selectRecordingState
• Const selectRecordingState: OutputSelector<HMSStore, HMSRecording, (res: HMSRoom) => HMSRecording>
selectRemotePeers
• Const selectRemotePeers: OutputSelector<HMSStore, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>
Select remote peers(other users you're connected with via the internet) present in the room.
selectRoleChangeRequest
• Const selectRoleChangeRequest: OutputSelector<HMSStore, null | HMSRoleChangeRequest, (res1: HMSRoleChangeStoreRequest, res2: Record<string, HMSPeer>, res3: Record<string, HMSRole>) => null | HMSRoleChangeRequest>
Select the role change request received for your local peer.
selectRoomID
• Const selectRoomID: OutputSelector<HMSStore, string, (res: HMSRoom) => string>
Select the ID of the current room to which you are connected.
selectRoomStartTime
• Const selectRoomStartTime: OutputSelector<HMSStore, undefined | Date, (res: HMSRoom) => undefined | Date>
selectRoomStarted
• Const selectRoomStarted: OutputSelector<HMSStore, boolean, (res: HMSRoom) => boolean>
selectRoomState
• Const selectRoomState: OutputSelector<HMSStore, HMSRoomState, (res: HMSRoom) => HMSRoomState>
Select the current state of the room.
selectSessionId
• Const selectSessionId: OutputSelector<HMSStore, string, (res: HMSRoom) => string>
selectUnreadHMSMessagesCount
• Const selectUnreadHMSMessagesCount: OutputSelector<HMSStore, number, (res: Record<string, HMSMessage>) => number>
Select the number of unread messages.
selectVideoPlaylist
• Const selectVideoPlaylist: HMSPlaylistSelector
Functions
createDefaultStatsStore
▸ createDefaultStatsStore(): HMSStatsStore
Returns
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
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, any>
selectAudioPlaylistTrackByPeerID
▸ selectAudioPlaylistTrackByPeerID(id?): StoreSelector<HMSStore, undefined | HMSTrack>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSTrack>
selectAudioTrackByPeerID
▸ selectAudioTrackByPeerID(id?): StoreSelector<HMSStore, undefined | HMSTrack>
Select the primary audio track of a peer given a peer ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSTrack>
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | number>
selectAuxiliaryAudioByPeerID
▸ selectAuxiliaryAudioByPeerID(id?): StoreSelector<HMSStore, undefined | HMSTrack>
Select the first auxiliary audio track of a peer given a peer ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSTrack>
selectAuxiliaryTracksByPeerID
▸ selectAuxiliaryTracksByPeerID(id?): StoreSelector<HMSStore, HMSTrack[]>
Select an array of auxiliary tracks of a peer given a peer ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, HMSTrack[]>
selectCameraStreamByPeerID
▸ selectCameraStreamByPeerID(id?): StoreSelector<HMSStore, undefined | HMSTrack>
Select the camera stream of a peer given a peer ID. This is the primary video track of a peer.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSTrack>
selectConnectionQualities
▸ selectConnectionQualities(store): Record<string, HMSConnectionQuality>
Parameters
| Name | Type |
|---|---|
store | HMSStore |
Returns
Record<string, HMSConnectionQuality>
selectConnectionQualityByPeerID
▸ selectConnectionQualityByPeerID(id?): StoreSelector<HMSStore, undefined | HMSConnectionQuality>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSConnectionQuality>
selectDevices
▸ selectDevices(store): DeviceMap
Select the available audio input, audio output and video input devices on your machine.
Parameters
| Name | Type |
|---|---|
store | HMSStore |
Returns
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
| Name | Type |
|---|---|
timeMs | number |
Returns
OutputSelector<HMSStore, undefined | boolean, (res: HMSRoom) => undefined | 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
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | 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
| Name | Type |
|---|---|
store | HMSStore |
Returns
boolean
selectIsLocalAudioPluginPresent
▸ selectIsLocalAudioPluginPresent(pluginName): OutputSelector<HMSStore, boolean, (res: string[]) => boolean>
Parameters
| Name | Type |
|---|---|
pluginName | string |
Returns
OutputSelector<HMSStore, boolean, (res: string[]) => 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
| Name | Type |
|---|---|
store | HMSStore |
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
| Name | Type |
|---|---|
store | HMSStore |
Returns
boolean
selectIsLocalVideoPluginPresent
▸ selectIsLocalVideoPluginPresent(pluginName): OutputSelector<HMSStore, boolean, (res: string[]) => boolean>
Parameters
| Name | Type |
|---|---|
pluginName | string |
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | boolean>
selectLocalMediaSettings
▸ selectLocalMediaSettings(store): HMSMediaSettings
Select your media settings i.e., choosen audio input device, audio output device and video input device.
Parameters
| Name | Type |
|---|---|
store | HMSStore |
Returns
selectMessageIDsInOrder
▸ selectMessageIDsInOrder(store): string[]
Select IDs of messages you've sent or received sorted chronologically.
Parameters
| Name | Type |
|---|---|
store | HMSStore |
Returns
string[]
selectMessagesByPeerID
▸ selectMessagesByPeerID(id?): StoreSelector<HMSStore, undefined | HMSMessage[]>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSMessage[]>
selectMessagesByRole
▸ selectMessagesByRole(id?): StoreSelector<HMSStore, undefined | HMSMessage[]>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSMessage[]>
selectMessagesUnreadCountByPeerID
▸ selectMessagesUnreadCountByPeerID(id?): StoreSelector<HMSStore, number>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, number>
selectMessagesUnreadCountByRole
▸ selectMessagesUnreadCountByRole(id?): StoreSelector<HMSStore, number>
Parameters
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, null | HMSPeer>
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
| Name | Type |
|---|---|
peerId | string |
Returns
OutputSelector<HMSStore, any, (res: null | HMSPeer) => any>
selectPeerName
▸ selectPeerName(peerId): OutputSelector<HMSStore, undefined | string, (res: null | HMSPeer) => undefined | string>
Parameters
| Name | Type |
|---|---|
peerId | string |
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
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | string>
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
| Name | Type |
|---|---|
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
| Name | Type | Description |
|---|---|---|
role | string | HMSRoleName |
Returns
OutputSelector<HMSStore, HMSPeer[], (res: HMSPeer[]) => HMSPeer[]>
HMSPeer[]
selectRoleByRoleName
▸ selectRoleByRoleName(roleName): OutputSelector<HMSStore, HMSRole, (res: Record<string, HMSRole>) => HMSRole>
Parameters
| Name | Type |
|---|---|
roleName | string |
Returns
OutputSelector<HMSStore, HMSRole, (res: Record<string, HMSRole>) => HMSRole>
selectRolesMap
▸ selectRolesMap(store): Record<string, HMSRole>
Select available roles in the room as a map between the role name and HMSRole object.
Parameters
| Name | Type |
|---|---|
store | HMSStore |
Returns
Record<string, HMSRole>
selectRoom
▸ selectRoom(store): HMSRoom
Select the current HMSRoom object to which you are connected.
Parameters
| Name | Type |
|---|---|
store | HMSStore |
Returns
selectScreenShareAudioByPeerID
▸ selectScreenShareAudioByPeerID(id?): OutputSelector<HMSStore, undefined | HMSTrack, (res: { audio: undefined | HMSTrack = audioTrack; video: undefined | HMSTrack = videoTrack }) => undefined | HMSTrack>
Select the screen share audio track of a peer given a peer ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
OutputSelector<HMSStore, undefined | HMSTrack, (res: { audio: undefined | HMSTrack = audioTrack; video: undefined | HMSTrack = videoTrack }) => undefined | HMSTrack>
selectScreenShareByPeerID
▸ selectScreenShareByPeerID(id?): OutputSelector<HMSStore, undefined | HMSTrack, (res: { audio: undefined | HMSTrack = audioTrack; video: undefined | HMSTrack = videoTrack }) => undefined | HMSTrack>
Select the screen share video track of a peer given a peer ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
OutputSelector<HMSStore, undefined | HMSTrack, (res: { audio: undefined | HMSTrack = audioTrack; video: undefined | HMSTrack = videoTrack }) => undefined | HMSTrack>
selectScreenSharesByPeerId
▸ selectScreenSharesByPeerId(id?): StoreSelector<HMSStore, { audio: undefined | HMSTrack = audioTrack; video: undefined | HMSTrack = videoTrack }>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, { audio: undefined | HMSTrack = audioTrack; video: undefined | HMSTrack = videoTrack }>
selectScreenshareAudioVolumeByPeerID
▸ selectScreenshareAudioVolumeByPeerID(id?): StoreSelector<HMSStore, undefined | number>
Select the local audio volume of the screen share of a peer given a peer ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | number>
selectSimulcastLayerByTrack
▸ selectSimulcastLayerByTrack(id?): StoreSelector<HMSStore, undefined | HMSSimulcastLayer>
Select the current simulcast layer of a track given a track ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSSimulcastLayer>
selectSpeakers
▸ selectSpeakers(store): Record<string, HMSSpeaker>
Parameters
| Name | Type |
|---|---|
store | HMSStore |
Returns
Record<string, HMSSpeaker>
selectTrackAudioByID
▸ selectTrackAudioByID(id?): StoreSelector<HMSStore, number>
Select the audio level of a track given a track ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, number>
selectTrackByID
▸ selectTrackByID(id?): StoreSelector<HMSStore, null | HMSTrack>
Select the HMSTrack object given a track ID.
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, null | HMSTrack>
selectVideoPlaylistAudioTrackByPeerID
▸ selectVideoPlaylistAudioTrackByPeerID(id?): StoreSelector<HMSStore, undefined | HMSTrack>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSTrack>
selectVideoPlaylistVideoTrackByPeerID
▸ selectVideoPlaylistVideoTrackByPeerID(id?): StoreSelector<HMSStore, undefined | HMSTrack>
Parameters
| Name | Type |
|---|---|
id? | string |
Returns
StoreSelector<HMSStore, undefined | HMSTrack>
selectVideoTrackByPeerID
▸ selectVideoTrackByPeerID(id?): StoreSelector<HMSStore, undefined | HMSTrack>
Select the primary video track of a peer given a peer ID.
Parameters
| Name | Type |
|---|---|
id? | string |