[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110907":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":33,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":14,"starSnapshotCount":14,"syncStatus":13,"lastSyncTime":37,"discoverSource":38},110907,"iphone-mirror-windows","0xCodez\u002Fiphone-mirror-windows","0xCodez","Mirror and control your iPhone on Windows: AirPlay receiver in an iPhone-shaped window, plus mouse and keyboard control over USB",null,"Python",198,36,2,0,5,29,84,20,77.53,"GNU General Public License v3.0",false,"main",true,[25,26,27,28,29,30,31,32],"airplay","ios","iphone","pyside6","python","screen-mirroring","webdriveragent","windows","2026-11-08 17:32:22","2026-11-23 19:21:13","# iPhone Mirror for Windows\n\niPhone Mirror turns a Windows PC into an AirPlay screen-mirroring receiver and shows your\niPhone in a frameless, rounded, iPhone-shaped window that floats on top of your other apps,\nmuch like \"iPhone Mirroring\" on macOS. Picture and sound come over Wi-Fi with nothing to\ninstall on the phone. If you also connect the iPhone with a cable once and set up\nWebDriverAgent, you can control it from the PC with your mouse and keyboard.\n\n## Features\n\n- **Wireless AirPlay mirroring with sound.** The iPhone sees the PC as an AirPlay receiver\n  under Control Center > Screen Mirroring. No app on the phone, no cable.\n- **iPhone-shaped window.** Frameless, rounded, always on top by default, resizable, and it\n  remembers its position.\n- **Rotation.** When the iPhone turns to landscape, the window turns with it.\n- **Screenshots.** Save the current frame as a PNG in one click.\n- **Optional mouse and keyboard control over USB.** Tap, long press, swipe, scroll, type,\n  Home, App Switcher and volume, all through\n  [WebDriverAgent](https:\u002F\u002Fgithub.com\u002Fappium\u002FWebDriverAgent).\n\n## Requirements\n\n- Windows 10 or Windows 11\n- [Python](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F) 3.11 or newer (check \"Add python.exe to PATH\"\n  during setup)\n- The iPhone and the PC on the same Wi-Fi network\n\nFor the optional USB control you also need:\n\n- a USB cable for the iPhone\n- **iTunes from [apple.com](https:\u002F\u002Fwww.apple.com\u002Fitunes\u002F)** (it installs Apple's USB driver\n  service; Sideloadly needs the apple.com version rather than the Microsoft Store apps)\n- an Apple ID; a free one is enough\n\n## Install\n\n1. Download this repository (**Code > Download ZIP**, or `git clone`) and put it in a folder\n   you will keep, for example `C:\\Apps\\iphone-mirror`.\n2. Double-click **`install.bat`**.\n\n`install.bat`:\n\n- checks that Python 3.11+ is available,\n- creates a private virtual environment in `%LOCALAPPDATA%\\iPhoneMirror\\venv`,\n- installs the dependencies from `requirements.txt` into it,\n- creates an **iPhone Mirror** shortcut on the Desktop and in the Start menu. The shortcut\n  runs `pythonw -m iphone_mirror` from the repository folder, so no console window opens.\n\nIf you move the folder later, run `install.bat` again so the shortcuts point to the new\nlocation. `run.bat` starts the app without a shortcut, and `control.bat` runs the USB\ncontrol helper (see below).\n\n## Usage\n\n1. Start **iPhone Mirror**. An iPhone-shaped window appears with the text\n   **\"Waiting for iPhone\"**. The footer shows the PC's addresses:\n   `PC: \u003Cips>  -  iPhone and PC must be on the same Wi-Fi`.\n2. **First start only:** Windows Defender Firewall asks whether Python may use the network.\n   Tick **Private networks** and click **Allow**.\n3. Make sure Windows treats your Wi-Fi as a **private** network:\n   Settings > Network & internet > Wi-Fi > *your network* > Network profile type > **Private**.\n4. On the iPhone, open **Control Center > Screen Mirroring** and choose the name of this PC\n   (by default the computer name; you can change it with right-click > **Rename PC...**).\n5. The window shows **\"Connecting...\"** and then the iPhone screen.\n\nOnly one copy of the app runs at a time: starting it again just brings the existing window\nto the front.\n\n## Window controls\n\nMove the mouse over the window to show the **top bar**. From left to right it has:\n\n- a label with the device name, the frame rate and the control status,\n- **Control** (hand pointer icon): turns USB control on or off. White when off, pulsing\n  orange while starting, green when ready, red after an error,\n- **Home** (circle),\n- **Pin**: keep the window always on top,\n- **Minimize**,\n- **Close**.\n\n### Mirroring only (control off, the default)\n\n| Action | What it does |\n|---|---|\n| Left-drag anywhere | Move the window |\n| Double-click | Switch between big and normal size |\n| Ctrl + mouse wheel | Resize |\n| Ctrl + Plus \u002F Ctrl + Minus | Resize |\n| Right-click | Open the menu |\n\n### With control on\n\nThese apply once control is **ready** (green Control button) and the iPhone screen is shown.\nWhile the window shows a placeholder instead of the iPhone screen, dragging still moves the\nwindow.\n\n| Action on the phone area | What the iPhone gets |\n|---|---|\n| Click | Tap. It is sent about 0.2 s after the click, in case a second click makes it a double tap |\n| Press and hold for 0.5 s or longer without moving | Long press |\n| Drag | Swipe. It is sent when you release the button and lasts as long as your drag did (clamped to 0.06 - 1.5 s) |\n| Double-click | Double tap (both taps are sent together, so apps see a real double tap) |\n| Mouse wheel | Scroll. Wheel steps are collected for about 120 ms and sent as one scroll |\n| Typing | Text input. Characters are buffered for about 80 ms; Backspace and Enter work |\n| Drag the top bar, or Alt + drag anywhere | Move the window |\n| Ctrl + mouse wheel | Resize |\n\nEvery tap or long press shows a short fading ripple where it landed; a swipe shows a fading\nline from its start to its end.\n\n### Keyboard shortcuts (both modes)\n\n| Shortcut | Action |\n|---|---|\n| Ctrl + H | Home |\n| Ctrl + J | App Switcher |\n| Ctrl + Up \u002F Ctrl + Down | iPhone volume up \u002F down |\n| Ctrl + M | Mute \u002F unmute the sound on the PC |\n| Ctrl + U | Turn USB control on \u002F off |\n| Ctrl + Plus \u002F Ctrl + Minus | Resize the window |\n\nHome, App Switcher and iPhone volume act on the phone, so they only do something while\ncontrol is ready. App Switcher swipes up from the bottom edge and holds on iPhones with\nFace ID, and double-presses Home on iPhones with a Home button.\n\nCtrl + mouse wheel resizes in proportion to how far the wheel turns (about 6% per notch), so\nsmooth scrolling with a touchpad resizes smoothly too.\n\n### Right-click menu\n\n| Item | Action |\n|---|---|\n| Control iPhone (USB) | Turn control on or off (checkable) |\n| Home | Go to the Home Screen |\n| App Switcher | Open the App Switcher |\n| Volume Up \u002F Volume Down | Change the iPhone volume |\n| Always on Top | Keep the window above other windows |\n| Sound | Play the iPhone sound on the PC |\n| Size | Small, Medium or Large |\n| Save Screenshot | Save the current frame to `Pictures\\iPhone Mirror` |\n| Rename PC... | Change the name the iPhone shows under Screen Mirroring |\n| Open Log | Open `%LOCALAPPDATA%\\iPhoneMirror\\iphone_mirror.log` |\n| Quit | Exit the app |\n\nIf the controller reports an error, the app shows it in a non-blocking message box titled\n**\"iPhone control\"** with the full text, and the status also appears in the top bar label.\n\n## USB control (optional)\n\nAirPlay only carries picture and sound. To send taps and keystrokes back, iPhone Mirror\ntalks to [WebDriverAgent](https:\u002F\u002Fgithub.com\u002Fappium\u002FWebDriverAgent) (WDA), Appium's\nopen-source automation server built on Apple's XCUITest, which runs as a small app on the\nphone. iPhone Mirror starts it over USB with\n[pymobiledevice3](https:\u002F\u002Fgithub.com\u002Fdoronz88\u002Fpymobiledevice3). No Mac is needed, and on\niOS 17.4 or later (and on iOS 16 or earlier) no administrator rights either. iOS 17.0 - 17.3\ncan only be controlled with administrator rights: update the iPhone, or run\n`pymobiledevice3 remote tunneld` as administrator before you turn control on.\n\nThe commands below run in a terminal (Command Prompt or PowerShell) opened in the repository\nfolder. `control.bat` runs the helper with the app's own Python environment, so nothing has\nto be activated (it is the same as `python -m iphone_mirror.control ...` inside that\nenvironment).\n\n1. **Connect the iPhone.** Install **iTunes from apple.com**, connect the iPhone with a\n   cable, unlock it and tap **Trust** when it asks about this computer.\n2. **Turn on Developer Mode.** Run\n\n   ```bat\n   control.bat reveal-dev-mode\n   ```\n\n   This makes the Developer Mode switch appear on the phone (it also appears by itself once\n   WebDriverAgent is installed in step 4). Then on the iPhone go to\n   Settings > Privacy & Security > **Developer Mode**, turn it on and confirm. The phone\n   restarts; after the restart, unlock it and confirm **Turn On** once more.\n3. **Get WebDriverAgent.** Run\n\n   ```bat\n   control.bat get-wda\n   ```\n\n   It downloads Appium's prebuilt WebDriverAgent and saves it as\n   `WebDriverAgentRunner.ipa` in your `Downloads` folder.\n4. **Install it on the iPhone.** Open [Sideloadly](https:\u002F\u002Fsideloadly.io), select the iPhone\n   and `WebDriverAgentRunner.ipa`, enter your Apple ID and start. Sideloadly signs the app\n   with your Apple ID and installs it. With a **free** Apple ID the signature is valid for\n   **7 days**: after that, install it again with Sideloadly (paid developer accounts last a\n   year).\n5. **Trust the developer profile.** On the iPhone go to Settings > General >\n   **VPN & Device Management**, tap your Apple ID under \"Developer App\" and tap **Trust**.\n6. **Check everything.** Run\n\n   ```bat\n   control.bat doctor\n   ```\n\n   and fix whatever it reports until all checks pass.\n7. **Turn control on.** In the iPhone Mirror window press **Ctrl + U**, click the hand\n   button in the top bar, or right-click > **Control iPhone (USB)**. The button pulses orange\n   while WDA starts (the first time also downloads and mounts the Developer Disk Image, which\n   can take a minute) and turns green when it is ready.\n\nWebDriverAgent listens on port 8100 of the iPhone, and that port is reachable over Wi-Fi as\nwell as through the USB forward. When you turn control on, the app first looks for a WDA\nthat is already running, both on the USB forward and on the iPhone's Wi-Fi address, and only\nstarts a new one over USB if it finds none. So once WDA is up, control traffic can go over\nWi-Fi too. Keep the cable connected anyway while you work: WDA lives only as long as the test\nsession that launched it, and unplugging the cable usually ends that session.\n\n### Helper commands\n\n`control.bat COMMAND` (or `python -m iphone_mirror.control COMMAND`; add `--help` to any\ncommand for its options):\n\n| Command | What it does |\n|---|---|\n| `doctor` | Check everything USB control needs (`--ip ADDRESS` also checks WDA over Wi-Fi) |\n| `reveal-dev-mode` | Make the Developer Mode switch appear in the iPhone's Settings |\n| `get-wda` | Download WebDriverAgent as `WebDriverAgentRunner.ipa` (`--out PATH` to save it elsewhere) |\n| `start` | Start WebDriverAgent over USB without the app and keep it running until Ctrl+C |\n| `tap X Y` | Tap at X, Y (in points) on a running WDA |\n| `home` | Go to the Home Screen |\n| `type TEXT` | Type TEXT into the focused field (`\\n` = Return, `\\b` = Backspace) |\n\n`tap`, `home` and `type` talk to `http:\u002F\u002F127.0.0.1:8100` unless you pass `--url`.\n\n## Troubleshooting\n\n**The PC does not appear under Screen Mirroring**\n\n- The Wi-Fi network must be **Private** in Windows (see [Usage](#usage)).\n- Python must be allowed through the firewall on private networks: Start > \"Allow an app\n  through Windows Firewall\" > find `pythonw.exe` \u002F `python.exe` and tick **Private**.\n- The iPhone and the PC must be on the same network and subnet. Guest networks and routers\n  with \"client isolation\" \u002F \"AP isolation\" block devices from seeing each other. A VPN on\n  either device can do the same.\n- Restart the app; it announces itself again with mDNS when it starts.\n\n**\"Could not decrypt the video\"**\n\nStop Screen Mirroring on the iPhone and connect again. If it keeps happening, open the log\n(right-click > **Open Log**) and attach it to an issue.\n\n**\"iPhone is locked\"**\n\nUnlock the iPhone; mirroring continues on its own.\n\n**No sound**\n\nCheck that **Sound** is ticked in the right-click menu (or press Ctrl + M) and that Windows\nplays to the right output device. The iPhone's own volume buttons also control the level.\n\n**Control does not start or stops working**\n\n- Run `control.bat doctor` (see [USB control](#usb-control-optional)) and fix what it\n  reports. The error box titled \"iPhone control\" shows the same message.\n- A free Apple ID signature expires after 7 days: if WDA suddenly fails to launch, install\n  `WebDriverAgentRunner.ipa` again with Sideloadly.\n- \"Untrusted Developer\" on the phone: trust the profile in Settings > General >\n  VPN & Device Management.\n- Logs are in `%LOCALAPPDATA%\\iPhoneMirror\\*.log`: `iphone_mirror.log` for the app and\n  `wda_runner.log` \u002F `wda_forward.log` for the WebDriverAgent processes.\n\n## Limitations\n\n- **Protected content is not mirrored.** Apps that use DRM (Netflix, Apple TV and similar)\n  show a black screen. The iPhone decides this, not the receiver.\n- **Resolution.** The iPhone is asked for a stream 1080 pixels high by default. To try a\n  sharper picture, quit the app, set `\"height\": 1440` in\n  `%LOCALAPPDATA%\\iPhoneMirror\\settings.json` and start it again. If the iPhone stops\n  connecting, change it back to `1080`.\n- **Control latency.** Every action is an HTTP request to WebDriverAgent, so expect about\n  100-200 ms before the iPhone reacts. A single click waits about 0.2 s more, to tell it\n  from a double-click.\n- **No live drag.** Swipes are sent when you release the mouse button, so you cannot drag\n  an item and watch it follow the pointer, or draw.\n- **Control needs setup.** It requires a cable, Developer Mode and a sideloaded WDA that\n  has to be re-signed every 7 days with a free Apple ID.\n\n## Settings\n\n`%LOCALAPPDATA%\\iPhoneMirror\\settings.json` is created on the first start. Useful keys:\n\n| Key | Default | Meaning |\n|---|---|---|\n| `name` | computer name | Name shown on the iPhone under Screen Mirroring |\n| `width`, `height` | `1920`, `1080` | Stream size requested from the iPhone (the height decides the resolution) |\n| `fps` | `60` | Frame rate requested from the iPhone |\n| `audio` | `true` | Play the iPhone sound on the PC |\n| `always_on_top` | `true` | Keep the window above other windows |\n\nThe file also stores the window position and the receiver's identity (a random MAC address\nand an Ed25519 key). Delete the file to reset everything; the iPhone will then see a new\nreceiver.\n\n## How it works\n\n- **Discovery.** The app advertises `_airplay._tcp` and `_raop._tcp` services over mDNS\n  (python-zeroconf) with the TXT records of an Apple TV, so the iPhone lists the PC under\n  Screen Mirroring.\n- **Control connection.** An asyncio RTSP server on TCP port 7000 handles `GET \u002Finfo`, then\n  AirPlay legacy pairing: `pair-setup` and `pair-verify` with Ed25519 signatures and an\n  X25519 key exchange.\n- **FairPlay.** `fp-setup` runs the FairPlay SAP handshake. A pure-Python port of the\n  open-source *playfair* code unwraps the 16-byte AES session key that the iPhone sends\n  FairPlay-encrypted during `SETUP`.\n- **Video.** The mirroring stream is H.264 over TCP, encrypted with AES-128-CTR. The key is\n  derived from the FairPlay key and the pair-verify shared secret. PyAV (FFmpeg) decodes it\n  on a background thread and scales frames to the window's size in device pixels.\n- **Audio.** AAC-ELD over RTP\u002FUDP, encrypted with AES-CBC, decoded with PyAV and played with\n  sounddevice.\n- **Window.** PySide6 (Qt) draws a frameless, translucent, rounded window with the frame,\n  placeholders and controls.\n- **Control.** pymobiledevice3 finds the iPhone through usbmux, checks Developer Mode, mounts\n  the Developer Disk Image, launches WebDriverAgent as an XCUITest (on iOS 17+ through a\n  userspace tunnel) and forwards a local port to WDA's port 8100. Mouse and keyboard input\n  becomes WDA HTTP calls (taps, swipes, text, buttons).\n\n## Development\n\nUse the app's environment (`%LOCALAPPDATA%\\iPhoneMirror\\venv\\Scripts\\python.exe`) or any\nPython 3.11+ with `requirements.txt` installed, and run everything from the repository\nfolder.\n\n```bat\nrem FairPlay known-answer tests (21 recorded sessions)\npython tests\u002Ftest_fairplay.py\n\nrem WebDriverAgent client tests\npython tests\u002Ftest_wda.py\n\nrem Full AirPlay session without an iPhone or a network:\nrem the receiver listens on 127.0.0.1:7100 only and does not announce itself\npython -m iphone_mirror --local\nrem in a second window: a simulated iPhone that pairs, does FairPlay and streams\nrem an encrypted H.264 test pattern and an AAC tone (arguments: host port seconds)\npython tools\u002Ffake_iphone.py 127.0.0.1 7100\n```\n\n`--local` also skips the single-instance check and uses a separate settings file, so it can\nrun next to a normal copy of the app. Other options:\n\n| Option | Meaning |\n|---|---|\n| `--port N` | RTSP port (default 7000, or 7100 with `--local`) |\n| `--control` | Turn on iPhone control (USB \u002F WebDriverAgent) at launch |\n| `--grab DIR` | Save a PNG of the window every 2 seconds |\n| `--quit-after N` | Exit after N seconds |\n\n`tools\u002Fgen_fairplay.py` regenerates `iphone_mirror\u002Ffairplay\u002F_tables.py` and `_garble.py` from\nthe playfair C sources shipped with UxPlay:\n\n```bat\npython tools\u002Fgen_fairplay.py path\\to\\UxPlay\\lib\n```\n\n### Project layout\n\n| Path | Contents |\n|---|---|\n| `iphone_mirror\u002Fairplay.py` | RTSP server, session setup, `Receiver` |\n| `iphone_mirror\u002Fpairing.py` | Legacy pair-setup \u002F pair-verify |\n| `iphone_mirror\u002Ffairplay\u002F` | Pure-Python FairPlay SAP (playfair port) |\n| `iphone_mirror\u002Fvideo.py` | Mirror stream decryption and H.264 decoding |\n| `iphone_mirror\u002Faudio.py` | RTP audio decryption, decoding and playback |\n| `iphone_mirror\u002Fdiscovery.py` | mDNS advertisement |\n| `iphone_mirror\u002Fconfig.py` | Settings and receiver identity |\n| `iphone_mirror\u002Fui.py` | The iPhone-shaped window |\n| `iphone_mirror\u002Fcontrol\u002F` | WebDriverAgent client and USB bring-up |\n| `tests\u002F` | FairPlay and WDA tests |\n| `tools\u002F` | Simulated iPhone, FairPlay table generator |\n\n## Credits\n\n- [UxPlay](https:\u002F\u002Fgithub.com\u002FFDH2\u002FUxPlay), [RPiPlay](https:\u002F\u002Fgithub.com\u002FFD-\u002FRPiPlay) and\n  [shairplay](https:\u002F\u002Fgithub.com\u002Fjuhovh\u002Fshairplay), and the authors of the *playfair*\n  FairPlay code they ship. The protocol handling here was checked against UxPlay.\n- [pymobiledevice3](https:\u002F\u002Fgithub.com\u002Fdoronz88\u002Fpymobiledevice3) for talking to the iPhone\n  over USB.\n- [Appium WebDriverAgent](https:\u002F\u002Fgithub.com\u002Fappium\u002FWebDriverAgent) for input on the iPhone.\n- [PyAV](https:\u002F\u002Fgithub.com\u002FPyAV-Org\u002FPyAV) and FFmpeg for decoding.\n- [PySide6](https:\u002F\u002Fdoc.qt.io\u002Fqtforpython-6\u002F) (Qt for Python) for the window.\n- [python-zeroconf](https:\u002F\u002Fgithub.com\u002Fpython-zeroconf\u002Fpython-zeroconf) for mDNS.\n- The FairPlay test vectors come from\n  [openairplay\u002Fairplay2-receiver](https:\u002F\u002Fgithub.com\u002Fopenairplay\u002Fairplay2-receiver) and\n  [omarroth\u002Fdoubletake](https:\u002F\u002Fgithub.com\u002Fomarroth\u002Fdoubletake).\n\n## License\n\n[GPL-3.0](LICENSE). The `iphone_mirror\u002Ffairplay\u002F` module is a port of the GPL-3.0 playfair\ncode (see [licenses\u002Fplayfair-LICENSE.md](licenses\u002Fplayfair-LICENSE.md)), so the whole\napplication is distributed under the GPL-3.0.\n\n## Disclaimer\n\nThis project is not affiliated with, endorsed by, or sponsored by Apple Inc. AirPlay,\niPhone, FairPlay and iOS are trademarks of Apple Inc., registered in the U.S. and other\ncountries. Use it only with devices and content you are allowed to mirror.\n","这是一个让 Windows 电脑作为 AirPlay 接收端，实现 iPhone 无线投屏与 USB 键鼠控制的工具。核心功能包括：基于 Wi-Fi 的低延迟 AirPlay 投屏（支持画面与音频）、iPhone 外形的悬浮窗口（支持旋转、截图、位置记忆），以及通过 WebDriverAgent 实现的 USB 连接下鼠标点击、滑动、键盘输入等交互控制。项目采用 Python 开发，依赖 PySide6 构建 GUI，无需在 iPhone 上安装任何应用。适用于开发者调试 iOS 应用、UI 设计预览、远程演示或需要精细操控 iPhone 的桌面工作场景。","2026-11-24 04:39:56","CREATED_QUERY"]