npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-camera-rtmp-publisher

v1.0.2

Published

My new module

Readme

Expo Camera RTMP Publisher

A React Native/Expo module for RTMP streaming from a mobile device camera. Currently only iOS platform is supported.

Features

  • Video streaming via RTMP protocol
  • Front and back camera support with switching capability
  • Device flashlight control with brightness adjustment
  • Configurable video and audio settings (resolution, bitrate)
  • Audio muting control
  • Broadcasting state management (start/stop/error events)
  • Full integration with Expo permissions system
  • Hardware-accelerated video encoding
  • Built on HaishinKit for iOS

Installation

In managed Expo projects

npx expo install expo-camera-rtmp-publisher

In bare React Native projects

Make sure you have installed and configured the expo package before continuing.

npm install expo-camera-rtmp-publisher

iOS configuration

Run npx pod-install after installing the npm package.

Note: Android support is currently under development.

Usage

Basic example

import React, { useRef, useState } from "react";
import { Button, View } from "react-native";
import {
  ExpoCameraRtmpPublisherView,
  requestCameraPermissionsAsync,
  requestMicrophonePermissionsAsync,
} from "expo-camera-rtmp-publisher";

export default function App() {
  const [isPublishing, setIsPublishing] = useState(false);
  const [cameraReady, setCameraReady] = useState(false);
  const publisherRef = useRef(null);

  const startPublishing = async () => {
    try {
      await publisherRef.current?.startPublishing(
        "rtmp://your-rtmp-server/live",
        "stream-key",
        {
          videoWidth: 1080,
          videoHeight: 1920,
          videoBitrate: 2000000,
          audioBitrate: 128000,
        },
      );
    } catch (err) {
      console.error("Broadcasting error:", err);
    }
  };

  return (
    <View style={{ flex: 1 }}>
      <ExpoCameraRtmpPublisherView
        ref={publisherRef}
        style={{ flex: 1 }}
        cameraPosition="front"
        muted={false}
        onReady={() => setCameraReady(true)}
        onPublishStarted={() => setIsPublishing(true)}
        onPublishStopped={() => setIsPublishing(false)}
        onPublishError={(error) => console.error(error)}
      />

      {cameraReady && (
        <Button
          title={isPublishing ? "Stop Broadcasting" : "Start Broadcasting"}
          onPress={isPublishing
            ? () => publisherRef.current?.stopPublishing()
            : startPublishing}
        />
      )}
    </View>
  );
}

Permissions

Before using the camera and microphone, you need to request permissions:

import { requestCameraPermissionsAsync, requestMicrophonePermissionsAsync } from 'expo-camera-rtmp-publisher;

async function requestPermissions() {
  const cameraPermission = await requestCameraPermissionsAsync();
  const microphonePermission = await requestMicrophonePermissionsAsync();
  
  if (!cameraPermission.granted || !microphonePermission.granted) {
    // Handle missing permissions
  }
}

Required Configuration Files

For the module to work properly, you need to add the following configurations to your project files:

iOS (Info.plist)

Add the following to your ios/Info.plist file to request camera and microphone permissions:

<key>NSCameraUsageDescription</key>
<string>The application requests access to the camera for video broadcasting</string>
<key>NSMicrophoneUsageDescription</key>
<string>The application requests access to the microphone for audio broadcasting</string>

API

ExpoCameraRtmpPublisherView

Properties

| Property | Type | Description | | ------------------ | ------------------------- | ----------------------------------------- | | cameraPosition | 'front' | 'back' | Camera position (default: 'front') | | muted | boolean | Audio muting state (default: false) | | onReady | () => void | Callback when the camera is ready | | onPublishStarted | () => void | Callback when broadcasting starts | | onPublishStopped | () => void | Callback when broadcasting stops | | onPublishError | (error: string) => void | Callback when a broadcasting error occurs |

Methods

| Method | Parameters | Description | | ----------------- | ------------------------------------------------------- | --------------------------------------- | | startPublishing | (url: string, name: string, options?: PublishOptions) | Starts RTMP broadcasting | | stopPublishing | () | Stops RTMP broadcasting | | switchCamera | () | Switches between front and back cameras | | toggleTorch | (level: number) | Controls flashlight (0.0-1.0) |

PublishOptions Type

| Property | Type | Default | Description | | -------------- | -------- | --------- | -------------------------------- | | videoWidth | number | 1080 | Video width in pixels | | videoHeight | number | 1920 | Video height in pixels | | videoBitrate | number | 2000000 | Video bitrate in bits per second | | audioBitrate | number | 128000 | Audio bitrate in bits per second |

Permission Functions

| Function | Return Type | Description | | ----------------------------------- | ----------------------------- | --------------------------------- | | requestCameraPermissionsAsync | Promise<PermissionResponse> | Requests camera access | | requestMicrophonePermissionsAsync | Promise<PermissionResponse> | Requests microphone access | | getCameraPermissionsAsync | Promise<PermissionResponse> | Gets camera permission status | | getMicrophonePermissionsAsync | Promise<PermissionResponse> | Gets microphone permission status |

PermissionResponse Type

| Property | Type | Description | | --------- | --------- | ------------------------------------------------- | | status | string | Permission status ('granted', 'denied', etc.) | | granted | boolean | Whether permission is granted |

License

MIT