useMediaQuality
Installation
npx sse-hooks add use-media-quality
yarn dlx sse-hooks add use-media-quality
pnpm dlx sse-hooks add use-media-quality
deno run -A npm:sse-hooks add use-media-quality
bunx sse-hooks add use-media-quality
Usage
import { useMediaQuality } from "./{hooks file}";
const { quality, setQuality, isChanging } = useMediaQuality(userVideoStream);
const handleHDClick = () => {
setQuality("high"); // Switches to 1280x720
};
API
Parameters
| Prop | Default | Type |
|---|---|---|
stream | - |
The MediaStream containing the video track to adjust. |
Returns
| Return Value | Default | Type |
|---|---|---|
return | - |
Hook return value |
Types Aliases
Changelog
31af5 — Refactor useBattery hook and remove utility functions
c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation
30da4 — feat: add new hooks and their metadata
2f161 — feat: add useConferenceSystem, useKbd, useMediaQuality, useNetworkInformation, usePortal, useRoleGuard, useScreenShare, useSymbol hooks
useKbd
Custom hook that detects the operating system (Mac vs. Windows/Linux) and provides a normalized map of keyboard keys (e.g., mapping "Meta" to "Command" on Mac and "Ctrl" on Windows).
useMemoizedFn
A hook that returns a memoized version of a function. Unlike `useCallback`, the function identity remains stable across re-renders, but it always has access to the latest props and state without needing a dependency array. This is particularly useful for passing callbacks to optimized child components to prevent unnecessary re-renders while avoiding closure staleness.