Object containing media state (isAudioMuted, isVideoMuted, isOutputMuted,
isScreenSharing, localStream) and actions (toggleAudio, toggleVideo, switchCamera)
This hook extends the web useLocalMedia with React Native-specific features:
localStream is exposed directly for use with RTCViewswitchCamera toggles between front and rear camerasisScreenSharing) is read-only; screen sharing
is not supported on React Nativeimport { useLocalMedia } from '@hiyve/rn-react';
function MediaControls() {
const { isAudioMuted, isVideoMuted, toggleAudio, toggleVideo, switchCamera } = useLocalMedia();
return (
<View style={{ flexDirection: 'row' }}>
<Button title={isAudioMuted ? 'Unmute' : 'Mute'} onPress={toggleAudio} />
<Button title={isVideoMuted ? 'Camera On' : 'Camera Off'} onPress={toggleVideo} />
<Button title="Flip Camera" onPress={switchCamera} />
</View>
);
}
Access local media state and controls.
Provides the current mute/unmute status for audio, video, and output, along with toggle actions and the local camera stream.