apiVersion: capsule.dev/v0.1
kind: Capsule
name: lkmeet-livekit-client-utils
version: 0.1.0
type: library
purpose:
summary: 'Provides a collection of client-side utility functions and types essential
for interacting with LiveKit, including E2EE passphrase handling, random string
generation, LiveKit URL manipulation, and performance optimization hooks.
'
owns:
- E2EE passphrase encoding/decoding
- Room ID and random string generation
- LiveKit URL construction logic
- Client-side performance optimization hooks
- Common LiveKit-related types
does_not_own:
- LiveKit client SDK itself
- UI components
interfaces:
provides:
- kind: library
name: client-utils
description: Functions for passphrase encoding, random strings, room IDs, and
device detection.
- kind: library
name: getLiveKitURL
description: Function to construct LiveKit server URLs, including region handling.
- kind: library
name: types
description: TypeScript type definitions for LiveKit client interactions.
- kind: library
name: useLowCPUOptimizer
description: React hook for optimizing LiveKit client performance on low-CPU devices.
- kind: library
name: useSetupE2EE
description: React hook for setting up LiveKit E2EE worker and retrieving passphrase.
agent:
summary_for_ai: 'This capsule contains core client-side logic. Ensure `decodePassphrase`
correctly handles URL hashes for E2EE. `getLiveKitURL` should accurately modify
LiveKit Cloud URLs based on region. `useLowCPUOptimizer` must correctly detect
and respond to CPU constraints. All types in `types.ts` should be robust.
'
verification:
invariants:
- E2EE passphrase encoding/decoding must be symmetrical.
- Generated room IDs must be unique and short.
- LiveKit URL construction must correctly handle different hostnames and staging
environments.
x-reuse:
notes: 'The `isMeetStaging()` function in `client-utils.ts` is hardcoded to check
for `meet.staging.livekit.io`. This will need to be removed or parameterized for
reuse in other projects. The `new Worker(new URL(''livekit-client/e2ee-worker'',
import.meta.url))` path in `useSetupE2EE.ts` assumes a specific build setup and
might need adjustment for different bundlers or project structures.
'
x-reconstruct:
install: install.json