@hiyve/react - React bindings for the Hiyve SDK core state store.
Remarks
This package provides React hooks that efficiently track state changes
from the @hiyve/core HiyveStore. Each hook re-renders only when its
relevant data changes.
@hiyve/react
React bindings for the Hiyve SDK. Provides a provider component, hooks for connection, room, media, participants, recording, intelligence, presence, and more, plus optional cloud integration for building video conferencing applications with React 18+.
Manages global chat conversations via the cloud service. Fetches conversation lists, loads message history with cursor-based pagination, sends messages with optimistic updates, and subscribes to real-time message delivery when a conversation is active.
Manages additional camera feeds that join as separate ghost participants. Each camera creates an independent WebRTC connection, so the feed appears automatically in recordings and live streams.
Manages pairing a remote device (e.g., a phone) as an additional camera feed via QR code. The remote device joins the room as a ghost participant using a time-limited join token.
if (status === 'connected') { return<buttononClick={disconnect}>Disconnect Phone Camera</button>; }
return ( <div> <buttononClick={startPairing}>Pair Phone Camera</button> {qrUrl&&<imgsrc={`https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(qrUrl)}`}alt="QR Code"/>} {isExpired&&<p>Link expired. Tap to generate a new one.</p>} </div> ); }
Options (UseRemoteCameraOptions):
Option
Type
Default
Description
roomName
string
--
Room name to pair the remote camera into
ownerUserId
string
--
Owner's userId
baseUrl
string
window.location.origin
Base URL for the QR code link
joinPath
string
'/camera'
Path for the camera page
expiresIn
number
300
Token expiry in seconds
label
string
'Phone'
Label for the ghost camera
enabled
boolean
true
Whether the hook is enabled
Returns (UseRemoteCameraReturn):
Property
Type
Description
startPairing
() => Promise<void>
Initiate pairing (generates join token and QR URL)
disconnect
() => void
Disconnect the remote camera
qrUrl
string | null
URL to display as a QR code
status
'idle' | 'waiting' | 'connected' | 'error'
Current pairing status
ghostUserId
string | null
Ghost userId for the remote camera
error
string | null
Error message if pairing failed
isExpired
boolean
Whether the current token has expired
Ghost Camera Utilities
Utility functions for working with ghost camera participant IDs. Re-exported from @hiyve/core.
Export
Type
Description
GHOST_CAMERA_DELIMITER
string
The delimiter used in ghost camera userIds ('__cam__')
isGhostCamera(userId)
(userId: string) => boolean
Returns true if the userId belongs to a ghost camera participant
getGhostCameraLabel(userId)
(userId: string) => string | null
Extracts the human-readable label from a ghost camera userId
getGhostCameraOwner(userId)
(userId: string) => string | null
Extracts the owner's userId from a ghost camera userId
buildGhostCameraUserId(ownerUserId, label)
(ownerUserId: string, label: string) => string
Builds a ghost camera userId from the owner's userId and a label
Provider Props
HiyveProvider
HiyveProvider is the recommended provider. It accepts all HiyveStoreOptions plus optional cloud configuration:
Prop
Type
Default
Description
generateRoomToken
() => Promise<string>
auto
Returns a Hiyve room token. Defaults to POST /api/generate-room-token when using @hiyve/admin server middleware
Returns a short-lived cloud token. Receives { userId } so the callback can forward it to the backend. Defaults to POST /api/generate-cloud-token when using @hiyve/admin server middleware
cloudToken
string
-
Static cloud token. Use generateCloudToken instead for auto-refresh
cloudEnvironment
'production' | 'development'
'production'
Cloud API environment
cloudBaseUrl
string
-
Override the cloud API base URL
presence
boolean | { intervalMs?: number }
-
Enable automatic presence heartbeat. When true, the cloud client signals the server that the current user is online
Cloud Integration
Both room tokens and cloud tokens are generated automatically when your server uses @hiyve/admin middleware. HiyveProvider calls POST /api/generate-room-token and POST /api/generate-cloud-token by default -- no props needed.
// Zero-config -- room and cloud tokens are generated automatically <HiyveProvider> <App/> </HiyveProvider>
You can still pass custom generators or static tokens to override the defaults:
if (!cloudClient) return<p>Cloud not configured</p>;
// Use cloudClient for AI queries, room discovery, etc. }
Identity Bridge
When used alongside @hiyve/react-identity, the IdentityProvider automatically provides the authenticated user's email to cloud services and the HiyveProvider. This allows cloud tokens to be generated for the correct user without passing userId manually.
import { useIdentityEmail } from'@hiyve/react';
functionHeader() { constemail = useIdentityEmail(); returnemail ? <span>Signed in as {email}</span> : null; }
Hook
Returns
Description
useIdentityEmail()
string | null
Authenticated identity user's email, or null
Advanced: Direct Store Access
For custom integrations, access the HiyveStore directly:
import { useStore } from'@hiyve/react';
functionCustomComponent() { conststore = useStore(); // Access store methods for custom integrations }
Re-exported Types
All core state types are re-exported from @hiyve/core for convenience. The full set of types available from @hiyve/react:
Store
Type
Description
HiyveStoreState
Full state shape of the store
HiyveStoreOptions
Options accepted by the store / HiyveProvider
SliceName
Union of all slice names
Connection & Room
Type
Description
ConnectionState
Connection slice state
RoomState
Room slice state
RoomInfo
Room metadata returned by the signaling server
CreateRoomOptions
Options for createRoom()
JoinRoomWithTokenOptions
Options for joinRoomWithToken()
GetRoomInfoFromTokenOptions
Options for getRoomInfoFromToken()
RoomInfoFromToken
Room info returned from a join token
Participants & Media
Type
Description
Participant
Per-participant state
ParticipantsState
Participants slice state
LocalMediaState
Local audio/video/screen-share state
Capture (Recording, Streaming, Transcription)
Type
Description
RecordingOptions
Options for startRecording()
RecordingState
Recording slice state
StreamingOptions
Options for startStreaming()
StreamingState
Streaming slice state
TranscriptionEntry
Single transcription line
TranscriptionMoodData
Mood/sentiment data attached to a transcription
TranscriptionState
Transcription slice state
Chat & Waiting Room
Type
Description
ChatMessage
A single chat message
ChatState
Chat slice state
WaitingRoomUser
A user waiting to be admitted
WaitingRoomState
Waiting room slice state
WaitForHostState
Wait-for-host slice state
AiChatMessage
A single AI chat message
Audio Processing & Layout
Type
Description
AudioValidation
Audio validation result
AudioProcessingState
Audio processing slice state
LayoutState
Layout slice state
HandRaiseState
Hand raise slice state
Intelligence
Type
Description
CoachingHint
A single coaching hint
TopicShift
A detected topic shift
CoachingVariant
Coaching variant identifier
IntelligenceState
Intelligence slice state
Files & Stored Rooms
Type
Description
FileUploadOptions
Options for uploadFile()
FileUploadResult
Result of an upload
FileModifyOptions
Options for renaming, moving, or modifying a file
FileClient
File client interface
FileShareEntry
Share entry for a file
UserFile
A single user file
UserFilesState
User files slice state
TabsFeatureConfig
Resolved tabs feature configuration
StoredRoom
A stored room
StoredRoomTabsConfig
Tabs configuration on a stored room
StoredRoomUpdates
Updatable fields on a stored room
CreateStoredRoomOptions
Options for creating a stored room
StoredRoomsState
Stored rooms slice state
Active Rooms (Cloud)
Type
Description
ActiveRoom
A currently active (advertised) room
AdvertiseRoomOptions
Options for advertising a room
ActiveRoomsState
Active rooms slice state
Client
Type
Description
ClientState
Underlying RTC client slice state
ClientActions
Available client actions
ClientContextValue
Combined client state and actions
Join Tokens
Type
Description
JoinTokenErrorCode
Union of join token error code strings
JoinTokenError
Error class thrown for join token failures
Hook-Specific Types
Type
Description
UserChatMessage
Message returned from useUserChat
RoomFlowScreen
Screen state returned by useRoomFlow
UseRoomFlowReturn
Full return shape of useRoomFlow
UseJoinTokenState
State returned by useJoinToken
UseJoinTokenActions
Actions returned by useJoinToken
UseJoinTokenOptions
Options accepted by useJoinToken
AdditionalCamera
A single additional camera entry
UseAdditionalCamerasOptions
Options for useAdditionalCameras
UseAdditionalCamerasReturn
Return shape of useAdditionalCameras
UseRemoteCameraOptions
Options for useRemoteCamera
UseRemoteCameraReturn
Return shape of useRemoteCamera
OrphanedRoom
A detected orphaned room
UseOrphanedRoomsResult
Return shape of useOrphanedRooms
RoomFileStats
Aggregated file statistics for a room
MonthlyActivity
Monthly file/recording activity bucket
RoomStats
Combined room statistics (extends RoomFileStats)
RoomServerStats
Server-side session statistics for a room
RoomMonthlyActivity
Monthly server-side session activity bucket
UseRoomStatsOptions
Options for useRoomStats
NavigationGuardOptions
Options for useNavigationGuard
NavigationGuardResult
Return shape of useNavigationGuard
PresenceMatchConfig
Match configuration for useOnlineUsers
UseOnlineUsersResult
Return shape of useOnlineUsers
Cloud
Type
Description
CloudEnvironment
'production' | 'development' — re-exported from @hiyve/cloud
For advanced integrations, the underlying React contexts are exported:
Context
Description
StoreContext
Holds the HiyveStore instance — consume via useStore()
CloudClientContext
Holds the CloudClient instance — consume via useCloudClient()
IdentityBridgeContext
Holds identity info bridged from IdentityProvider — consume via useIdentityEmail()
Constants
Join token error codes, re-exported from @hiyve/core:
Constant
Value
Description
TOKEN_NOT_FOUND
'TOKEN_NOT_FOUND'
Token does not exist (HTTP 404)
TOKEN_EXPIRED
'TOKEN_EXPIRED'
Token has expired (HTTP 410)
INVALID_PASSWORD
'INVALID_PASSWORD'
Incorrect room password (HTTP 401)
USER_NOT_AUTHORIZED
'USER_NOT_AUTHORIZED'
User is not allowed to join via this token (HTTP 403)
ROOM_NOT_ACTIVE
'ROOM_NOT_ACTIVE'
Room is not active yet (HTTP 503)
Utilities
Function
Description
resolveTabsConfig(config, mode)
Resolves a StoredRoomTabsConfig into a flat TabsFeatureConfig for 'offline' or 'live' mode. Handles structured, legacy flat, and null configs. Re-exported from @hiyve/core.
cleanUserId(userId)
Sanitizes a user ID string for use with the signaling server. Re-exported from @hiyve/rtc-client.
userIdsMatch(a, b)
Compare two user IDs for equality. Use this instead of === whenever comparing a stored userId (from file content, database, or appData) with a runtime userId from useParticipants.
Requirements
React 18+
@hiyve/core and @hiyve/rtc-client as peer dependencies
@hiyve/cloud as optional peer dependency (for cloud features)
Related Packages
@hiyve/core -- Framework-agnostic state store (works with React, Angular, Vue, or any framework)
@hiyve/react-ui -- Pre-built UI components (video tile, video grid, control bar, sidebar)
@hiyve/react-capture -- Recording, streaming, and transcription components
@hiyve/react-collaboration -- Chat, polls, Q&A, and file manager components
@hiyve/react-intelligence -- AI assistant, meeting summary, alerts, and sentiment
@hiyve/react - React bindings for the Hiyve SDK core state store.
Remarks
This package provides React hooks that efficiently track state changes from the @hiyve/core HiyveStore. Each hook re-renders only when its relevant data changes.