### Install expo-nodemediaclient Source: https://github.com/nodemedia/expo-nodemediaclient/blob/main/README.md Install the library using npm. Ensure your Expo project uses Continuous Native Generation (CNG) or run `npx expo prebuild` first. ```bash npm install expo-nodemediaclient ``` -------------------------------- ### Install expo-camera Source: https://github.com/nodemedia/expo-nodemediaclient/blob/main/README.md Install the expo-camera dependency using npm or yarn to manage camera and microphone permissions. ```bash npm install expo-camera ``` -------------------------------- ### Start and Stop Streaming Source: https://github.com/nodemedia/expo-nodemediaclient/blob/main/README.md Use these methods to control the streaming session. Ensure the publisherRef is correctly initialized. ```javascript publisherRef.current?.start(url); ``` ```javascript publisherRef.current?.stop(); ``` -------------------------------- ### Expo Module Commands for NodeMediaClient Source: https://github.com/nodemedia/expo-nodemediaclient/blob/main/AGENTS.md Commands for Expo module-specific operations, including preparing the development environment and opening the iOS or Android example projects. Facilitates local development and testing. ```bash # Expo module-specific operations npm run expo-module # Prepare development environment npm run prepare # Open iOS example project npm run open:ios # Open Android example project npm run open:android ``` -------------------------------- ### NodePlayer Common Methods Source: https://github.com/nodemedia/expo-nodemediaclient/blob/main/README.md Control media playback using the `start` and `stop` methods on the player reference. ```javascript // Start playback playerRef.current?.start(url); // Stop playback playerRef.current?.stop(); ``` -------------------------------- ### File Organization Structure Source: https://github.com/nodemedia/expo-nodemediaclient/blob/main/AGENTS.md Example directory structure for the NodeMediaClient project, showing the placement of the main export file, native module wrapper, and component files. Promotes a clean and organized codebase. ```plaintext src/ ├── index.ts # Main barrel export file ├── ExpoNodeMediaClientModule.tsx # Native module wrapper ├── ExpoNodePlayerView.tsx # Player component └── ExpoNodePublisherView.tsx # Publisher component ``` -------------------------------- ### NodePublisher Component for Streaming Source: https://github.com/nodemedia/expo-nodemediaclient/blob/main/README.md Use the NodePublisher component to stream live video and audio. Configure stream URL, audio, and video parameters. Includes methods to start and stop streaming. ```javascript import { NodePublisher, NodePublisherRef } from 'expo-nodemediaclient'; import { useRef, useState } from 'react'; export default function PublisherScreen() { const [url, setUrl] = useState('rtmp://192.168.0.2/live/stream'); const [isPublishing, setIsPublishing] = useState(false); const publisherRef = useRef(null); const handleTogglePublish = () => { if (!isPublishing) { setIsPublishing(true); publisherRef.current?.start(url); } else { setIsPublishing(false); publisherRef.current?.stop(); } }; return (