react-native-streampack-haishinkit
v1.0.0
Published
Production-ready React Native module for live streaming with StreamPack (Android) and HaishinKit (iOS)
Maintainers
Readme
@trickyc0d3r/react-native-streampack-haishinkit
Production-ready React Native module for live streaming using StreamPack on Android and HaishinKit.swift on iOS.
- Supports React Native
>=0.80.1withnewArchEnabled=trueandhermesEnabled=true - Modern TurboModules/Fabric support
- Unified API for JS/TS
- Easy integration
Features
- iOS: HaishinKit.swift for RTMP/RTSP streaming
- Android: StreamPack for RTMP/RTSP streaming
- Full control over camera, audio, mute, switch camera, bitrate, events, errors
- Native Preview View bridged to React Native
- Singleton pattern for stream manager and preview on iOS for robust lifecycle
- Typed React/JS hooks and components
- Autolinking and native module auto-discovery
Installation
yarn add @trickyc0d3r/react-native-streampack-haishinkit
cd ios && pod installUsage Example
import { StreamView, useStream } from "@trickyc0d3r/react-native-streampack-haishinkit";
function MyStreamScreen() {
const {
startStream,
stopStream,
switchCamera,
mute,
unmute,
isStreaming,
streamingError,
} = useStream();
return (
<View style={{ flex: 1 }}>
<StreamView style={{ flex: 1 }} />
{/* Controls */}
</View>
);
}iOS Singleton/DI Architecture Explanation
StreamManageris a singleton (sharedInstance) that holds theRTMPStream,RTMPConnection, and theHKViewfor preview.- The
RNHKStreamViewManageralways returns the singleton's preview view. - JS/TS API always interacts with the singleton, safely bridging stream and UI.
- No memory leaks, robust lifecycle for production.
License
MIT.
This repo uses HaishinKit.swift and StreamPack under their respective licenses.
