Index of every page on this site: llms.txt
All skills
software-mansion-labs avatar

/react-native-client

@43cde80
Run it yourself

React Native / Expo SDK for Fishjam — video/audio streaming on iOS and Android. Use when writing a React Native or Expo app that calls Fishjam, configures the Fishjam Expo plugin, sets up permissions, runs background streaming, integrates CallKit, or renders RTCView. Trigger on: '@fishjam-cloud/react-native-client', 'fishjam expo plugin', 'FishjamProvider mobile', 'useCameraPermissions', 'useMicrophonePermissions', 'useForegroundService', 'useCallKit', 'useCallKitEvent', 'useCallKitService', 'RTCView', 'RTCPIPView', 'ScreenCapturePickerView', 'startPIP', 'stopPIP', 'AudioDeviceType', 'useAudioOutput', '@fishjam-cloud/react-native-webrtc', 'fishjam react native', 'expo fishjam', 'fishjam ios', 'fishjam android', 'broadcast extension'. Re-exports @fishjam-cloud/react-client hooks plus mobile-only: permissions, foreground service, iOS broadcast extension, audio routing, CallKit, Expo config plugin.

  • 11 files
  • 54.9 KB
  • MIT
  • Updated 6 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/software-mansion-labs/skills/react-native-client

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

rtcview.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

RTCView (and RTCPIPView)

RTCView is the React Native equivalent of an HTML <video> element — it renders a MediaStream natively. On the web you'd use <video ref={el => { if (el) el.srcObject = stream; }} />; on RN, use <RTCView mediaStream={stream} />.

import { RTCView, RTCPIPView } from '@fishjam-cloud/react-native-client';

These are re-exported from @fishjam-cloud/react-native-webrtc (the fork; installed as a peer dependency). Source for the wrapper: packages/mobile-client/src/overrides/RTCView.tsx.

Basic usage

import { View } from 'react-native';
import { RTCView, usePeers } from '@fishjam-cloud/react-native-client';

function CallScreen() {
  const { localPeer, remotePeers } = usePeers();

  return (
    <View style={{ flex: 1 }}>
      {localPeer?.cameraTrack && (
        <RTCView
          mediaStream={localPeer.cameraTrack.stream}
          style={{ width: 200, height: 200 }}
          mirror
        />
      )}
      {remotePeers.map((peer) =>
        peer.cameraTrack ? (
          <RTCView
            key={peer.id}
            mediaStream={peer.cameraTrack.stream}
            style={{ width: 200, height: 200 }}
            objectFit="cover"
          />
        ) : null,
      )}
    </View>
  );
}

Props

import type { MediaStream } from '@fishjam-cloud/react-native-client';
import type { ViewStyle } from 'react-native';
import type { RTCPIPOptions } from '@fishjam-cloud/react-native-webrtc';

type RTCVideoViewProps = {
  mediaStream: MediaStream;   // REQUIRED — from useCamera/useScreenShare/peer.cameraTrack.stream/useLivestreamViewer.

  // Forwarded to the underlying react-native-webrtc RTCView:
  style?: ViewStyle;
  objectFit?: 'contain' | 'cover';
  mirror?: boolean;            // Flip horizontally — common for local camera preview
  zOrder?: number;             // Android only
  pip?: RTCPIPOptions;         // Declarative Picture-in-Picture — see picture-in-picture.md
  onDimensionsChange?: (dims: { width: number; height: number }) => void; // Standard way to compute aspect ratio
  // (...other RN-WebRTC RTCView props — consult the upstream types)
};

The SDK's wrapper takes mediaStream as a typed prop; internally it calls mediaStream.toURL() and forwards it as streamURL to the native component. You do not pass streamURL yourself.

Important: the MediaStream type must come from @fishjam-cloud/react-native-webrtc (re-exported through @fishjam-cloud/react-native-client — import type { MediaStream } from '@fishjam-cloud/react-native-client'). The DOM MediaStream lacks .toURL() and the wrapper logs an error.

Local camera preview tips

Mirror the local preview so it matches what the user expects from a mirror:

<RTCView mediaStream={localPeer.cameraTrack.stream} mirror />

Don't mirror remote peers — you'd see their text appearing backwards.

Performance: many tiles

Each RTCView is a native surface. Rendering 20+ at once can stress the GPU. Strategies:

  • Request Variant.LOW for non-focused tiles via usePeers().setReceivedTracksQuality(...) (see ../react-client/simulcast-and-bandwidth.md).
  • Show only the speakers / spotlighted peers; collapse others to thumbnails or text.

Audio

RTCView renders video only. Audio plays automatically once the SDK subscribes to a peer's audio track — no extra component needed. Local audio is muted by default in the SDK (no echo).

RTCPIPView

Superset of RTCView. Same props, plus pip.fallbackView — the React subtree to render while the PIP window is detached from the host view. This is the distinguishing reason to use RTCPIPView over RTCView with a pip prop. See picture-in-picture.md.

import { RTCPIPView } from '@fishjam-cloud/react-native-client';

<RTCPIPView
  mediaStream={presenter.cameraTrack.stream}
  style={{ flex: 1 }}
  pip={{ enabled: true, startAutomatically: true, fallbackView: <PausedPlaceholder /> }}
/>

When the user backgrounds the app, this view becomes the floating PIP window (assuming you enabled supportsPictureInPicture in the Expo plugin).

Sources

  • packages/mobile-client/src/overrides/RTCView.tsx
  • @fishjam-cloud/react-native-webrtc (RTCView native components)
  • fishjam-cloud/examples repo: mobile-react-native/minimal-react-native/
  • fishjam-cloud/examples repo: mobile-react-native/fishjam-chat/

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 43cde80. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 6 months ago

README badge

README badge for software-mansion-labs/skills/react-native-client