### Install LiveKit Expo Dependencies and Run Project Source: https://context7.com/livekit-examples/react-native-expo-quickstart/llms.txt This bash script outlines the commands to install the core LiveKit packages, Expo-specific plugins, and the Expo dev client. It also includes instructions for starting the development server and running the app on Android and iOS devices. ```bash # Install core dependencies npm install @livekit/react-native @livekit/react-native-webrtc livekit-client # Install Expo-specific plugins npm install @livekit/react-native-expo-plugin @config-plugins/react-native-webrtc # Install Expo dev client for native module support npm install expo-dev-client # Start development server npx expo start # Run on device (in separate terminal) npx expo run:android # For Android npx expo run:ios # For iOS ``` -------------------------------- ### Initialize LiveKitRoom and Audio Session in React Native Expo Source: https://context7.com/livekit-examples/react-native-expo-quickstart/llms.txt Demonstrates the setup of the `LiveKitRoom` component to manage the LiveKit server connection and session lifecycle. It also includes the essential `AudioSession.startAudioSession()` call required before connecting to ensure proper audio handling in the React Native environment. The `registerGlobals()` function must be called once before using any LiveKit components. ```tsx import { LiveKitRoom, AudioSession, registerGlobals } from '@livekit/react-native'; import { useEffect } from 'react'; // Required: Register LiveKit globals before using any LiveKit components registerGlobals(); export default function App() { // Start audio session before connecting useEffect(() => { const start = async () => { await AudioSession.startAudioSession(); }; start(); return () => { AudioSession.stopAudioSession(); }; }, []); return ( ); } ``` -------------------------------- ### Manage Audio Session Lifecycle in React Native Expo Source: https://context7.com/livekit-examples/react-native-expo-quickstart/llms.txt The AudioSession API manages the audio session, ensuring correct audio routing and handling on iOS and Android. It must be started before connecting to a room and stopped when leaving. This snippet demonstrates starting and stopping the audio session with a button. ```tsx import { AudioSession } from '@livekit/react-native'; import { useEffect, useState } from 'react'; import { Button, View } from 'react-native'; const AudioManager = () => { const [isAudioActive, setIsAudioActive] = useState(false); const startAudio = async () => { try { await AudioSession.startAudioSession(); setIsAudioActive(true); } catch (error) { console.error('Failed to start audio session:', error); } }; const stopAudio = async () => { try { await AudioSession.stopAudioSession(); setIsAudioActive(false); } catch (error) { console.error('Failed to stop audio session:', error); } }; // Auto-start on mount useEffect(() => { startAudio(); return () => { stopAudio(); }; }, []); return (