A cross-platform React Native application that allows you to mirror your phone screen to any TV using multiple protocols including AirPlay, Chromecast, and DLNA.
- Multi-Protocol Support: Connect to TVs using AirPlay, Chromecast, DLNA, or Miracast
- Cross-Platform: Works on both iOS and Android
- Automatic Device Discovery: Automatically finds compatible TVs on your local network
- Real-time Screen Mirroring: Low-latency screen casting with audio support
- Quality Settings: Adjustable resolution (480p to 4K), frame rate, and bitrate
- Modern UI: Clean React Native interface with smooth animations
- iOS 14.0 or later
- iPhone or iPad
- Android 5.0 (API 21) or later
- TV connected to the same Wi-Fi network
- Node.js 18+ and npm/yarn
- Apple TV (all generations)
- AirPlay 2 compatible smart TVs
- Mac computers
- Chromecast (all generations)
- Chromecast with Google TV
- Android TV devices
- Google Nest Hub
- Samsung Smart TVs
- LG Smart TVs
- Sony Smart TVs
- Most Smart TVs manufactured after 2012
- PlayStation 4/5
- Xbox consoles
Screen-mirroring/
├── src/
│ ├── App.tsx # Main app component
│ ├── components/
│ │ ├── DeviceCard.tsx # TV device card component
│ │ ├── StatusBadge.tsx # Connection status indicator
│ │ ├── StatsCard.tsx # Streaming statistics display
│ │ ├── FilterModal.tsx # Protocol filter modal
│ │ └── PickerModal.tsx # Settings picker modal
│ ├── screens/
│ │ ├── DevicesScreen.tsx # Device discovery screen
│ │ ├── MirrorScreen.tsx # Mirroring controls screen
│ │ └── SettingsScreen.tsx # Quality settings screen
│ ├── services/
│ │ ├── DeviceDiscoveryService.ts # Network discovery
│ │ ├── StreamingService.ts # Connection & streaming
│ │ └── ScreenCaptureService.ts # Screen capture wrapper
│ ├── context/
│ │ └── AppContext.tsx # Global state management
│ ├── types/
│ │ └── index.ts # TypeScript type definitions
│ └── native/
│ └── ScreenMirrorModule.ts # Native module interface
├── ios/
│ ├── ScreenMirrorModule.swift # iOS native module
│ └── ScreenMirrorModule.m # Objective-C bridge
├── android/
│ └── app/src/main/java/com/screenmirror/
│ ├── ScreenMirrorModule.kt # Android native module
│ └── ScreenMirrorPackage.kt # React Native package
├── package.json
├── tsconfig.json
└── babel.config.js
-
Clone the repository:
git clone https://github.com/your-username/Screen-mirroring.git cd Screen-mirroring -
Install dependencies:
npm install # or yarn install -
Install iOS pods (macOS only):
cd ios && pod install && cd ..
-
Run the app:
# iOS npm run ios # Android npm run android
-
Open
ios/ScreenMirror.xcworkspacein Xcode -
Select your development team
-
Add required capabilities:
- App Groups (for broadcast extension)
- Local Network Usage
-
Add to
Info.plist:<key>NSLocalNetworkUsageDescription</key> <string>Screen Mirror needs access to discover TVs on your network</string> <key>NSBonjourServices</key> <array> <string>_googlecast._tcp</string> <string>_airplay._tcp</string> </array>
-
Add to
AndroidManifest.xml:<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
-
Register the native package in
MainApplication.kt:packages.add(ScreenMirrorPackage())
-
Launch the app and grant network permissions when prompted
-
Discover Devices: The app automatically scans for compatible TVs
-
Select a TV: Tap on a discovered device to connect
-
Start Mirroring: Tap the "Start Mirroring" button
-
Adjust Settings: Configure quality in the Settings tab
The app uses a clean architecture with React Context for state management:
- Screens: Main views for navigation
- Components: Reusable UI components
- Services: Business logic and native module communication
- Context: Global state management with React Context
- Native Modules: Platform-specific screen capture and streaming
DeviceDiscoveryService: Discovers TVs via Bonjour/NSD and SSDPStreamingService: Manages connections and streamingScreenCaptureService: Handles platform screen capture APIs
- iOS: Uses ReplayKit for system-level screen capture
- Android: Uses MediaProjection API for screen capture
- Bonjour/NSD: For AirPlay and Chromecast discovery
- SSDP/UPnP: For DLNA device discovery
- WebSocket/HTTP: For streaming data
# Start Metro bundler
npm start
# Run on iOS
npm run ios
# Run on Android
npm run android
# Run tests
npm test
# Lint code
npm run lint
# Install iOS pods
npm run pod-install- Ensure your phone and TV are on the same Wi-Fi network
- Check that the TV's screen mirroring feature is enabled
- Pull down to refresh the device list
- Restart both the app and the TV
- Check for firewall restrictions
- Ensure the TV supports the selected protocol
- Lower the resolution or frame rate in Settings
- Move closer to your Wi-Fi router
- Reduce network congestion
iOS:
cd ios && pod install --repo-update && cd ..Android:
cd android && ./gradlew clean && cd ..MIT License - See LICENSE file for details
Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
For issues and feature requests, please use the GitHub Issues page.