Hiyve Components - v1.0.0
    Preparing search index...

    Interface LocalMediaState

    Local media state for the current user's devices.

    Tracks the mute/unmute state of local audio, video, and output, as well as the local camera stream for rendering.

    React Native adaptation: This type extends the web LocalMediaState with a localStream field. In React Native, the local camera stream is delivered as a MediaStream (from react-native-webrtc) and must be rendered using RTCView. The isScreenSharing field is always false because screen sharing is not supported in the React Native client.

    Media controls with local video preview:

    import { RTCView } from 'react-native-webrtc';

    function LocalVideoPreview() {
    const { isAudioMuted, isVideoMuted, localStream, toggleAudio, toggleVideo } = useLocalMedia();

    return (
    <View>
    {localStream && !isVideoMuted ? (
    <RTCView streamURL={localStream.toURL()} style={{ width: 120, height: 160 }} />
    ) : (
    <Text>Camera Off</Text>
    )}
    <Button title={isAudioMuted ? 'Unmute' : 'Mute'} onPress={toggleAudio} />
    <Button title={isVideoMuted ? 'Start Video' : 'Stop Video'} onPress={toggleVideo} />
    </View>
    );
    }

    Participant for remote participant media streams

    interface LocalMediaState {
        isAudioMuted: boolean;
        isOutputMuted: boolean;
        isScreenSharing: boolean;
        isVideoMuted: boolean;
        localStream: MediaStream | null;
    }
    Index

    Properties

    isAudioMuted: boolean

    Whether the local microphone is muted

    isOutputMuted: boolean

    Whether speaker/output is muted

    isScreenSharing: boolean

    Whether screen sharing is active.

    Always false in React Native. Screen sharing is only available on web.

    isVideoMuted: boolean

    Whether the local camera is muted/off

    localStream: MediaStream | null

    Local camera MediaStream for rendering via RTCView.

    This field is specific to @hiyve/rn-core and does not exist in the web @hiyve/core LocalMediaState. The stream is provided when the local camera is activated and should be rendered using RTCView from react-native-webrtc. It is null before the camera starts or after the user leaves the room.