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.

foreground-service.md

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

Foreground Service (Android)

Android suspends WebRTC peer connections when the app is backgrounded — unless the app runs a foreground service with an ongoing notification. The SDK provides useForegroundService to manage this.

This hook is a no-op on iOS. On iOS, backgrounded streaming relies on background modes declared in the Expo plugin (enableVoIPBackgroundMode, etc.) — see callkit.md for the VoIP scenario.

Source: packages/mobile-client/src/useForegroundService.ts.

Plugin prerequisite

{
  "android": { "enableForegroundService": true }
}

This adds the necessary <service> declarations to AndroidManifest.xml and the right FOREGROUND_SERVICE_* permissions.

Hook usage

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

function CallScreen() {
  useForegroundService({
    enableCamera: true,
    enableMicrophone: true,
    enableScreenSharing: false,
    channelId: 'fishjam-call',
    channelName: 'Active call',
    notificationTitle: 'On a call',
    notificationContent: 'Tap to return to MyApp.',
  });

  return /* call UI */;
}

ForegroundServiceConfig

type ForegroundServiceConfig = {
  enableCamera?: boolean;
  enableMicrophone?: boolean;
  enableScreenSharing?: boolean;
  channelId?: string;
  channelName?: string;
  notificationTitle?: string;
  notificationContent?: string;
};
Field Meaning
enableCamera / enableMicrophone / enableScreenSharing Toggle each foreground-service capability. Match what your app is actually using. Without the right capability flag, Android may suspend the corresponding track.
channelId A unique-per-package notification channel ID. Reused across calls — pick a stable string.
channelName User-visible channel name in Settings → Apps → Notifications.
notificationTitle First line of the ongoing notification.
notificationContent Second line.

The hook runs the service as long as it's mounted. Unmount → service stops, notification disappears.

Pattern: foreground service tied to call lifecycle

Mount on the CallScreen component; unmount when the user leaves the screen.

function App() {
  const [inCall, setInCall] = useState(false);
  return inCall ? <CallScreen onLeave={() => setInCall(false)} /> : <Lobby onJoin={() => setInCall(true)} />;
}

function CallScreen({ onLeave }: { onLeave: () => void }) {
  useForegroundService({
    enableCamera: true,
    enableMicrophone: true,
    channelId: 'fishjam-call',
    channelName: 'Call',
    notificationTitle: 'Call in progress',
    notificationContent: 'Tap to return.',
  });
  // ...
}

Without the foreground service

If you stream on Android without useForegroundService:

  • When the user opens the home screen / switches apps, the OS kills the WebRTC peer connection within seconds.
  • Other peers see peerDisconnected for your peer.
  • When the user returns, the SDK auto-reconnects (if reconnect is enabled), but the gap is jarring for everyone in the call.

iOS background streaming

iOS doesn't use the foreground-service concept. Instead:

  • Add background_modes to your Info.plist (the Expo plugin does this for the modes you opt in to).
  • ios.supportsPictureInPicture: true adds audio to UIBackgroundModes; ios.enableVoIPBackgroundMode: true adds voip. No dedicated flag exists for audio-only persistence — enable PiP support (which writes audio as a side-effect) or add audio to UIBackgroundModes manually in a bare workflow.

Without these, iOS suspends your app and the WebRTC connection within ~30 seconds of backgrounding.

Permissions required

Plugin handles these for Expo CNG. In bare workflow add to AndroidManifest.xml:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

Android 14+ enforces these strictly — the service won't start without the matching permission for the type you're using.

Sources

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