Skip to content

About

Stream your device in your browser via WebRTC

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

WebScrcpy

Control your rooted Android device directly from a browser over pure TCP. Install one APK on the device, grant root, start the service and open its address. No PC, ADB, WebRTC, UDP or relay server is required for screen streaming.

中文使用说明

Quick start

  1. Download the Android arm64 APK from Releases or the Build APK Actions artifact for development builds.
  2. Install on a rooted Android 8+ device and grant root.
  3. Optionally set a six-digit PIN. Start the service and open the displayed HTTP URL (default port 8079) in your browser.
  4. Start streaming from the local device page. H.264 is recommended; H.265 and Opus audio depend on browser and device support.

Architecture

flowchart LR
  subgraph Android["Rooted Android"]
    S["scrcpy-server / MediaCodec"] <-->|"Local abstract sockets"| G["Embedded Go server"]
  end
  G <-->|"HTTP / WebSocket TCP"| B["Browser / MSE"]
Loading

Video, audio and control share one WebSocket endpoint. Media packets are written directly under a single writer lock; TCP supplies backpressure without an extra gateway queue. Only one browser streams at a time; an explicit connection replaces the previous session, whereas an automatic retry cannot take over another browser. The displaced browser must reconnect manually. The APK uses one foreground-service strategy with optional boot startup. Touch, UHID keyboard/mouse/volume, clipboard and screen controls are retained where supported. Gamepads are not supported.

WebScrcpy is an independently maintained fork focused exclusively on rooted Android self-hosting. Desktop capture, NAS/fnOS, Docker and external ADB device management are not supported.

Build

Use GitHub Actions Build APK, or build on Linux/WSL with Go, JDK 17 and Android SDK 34. For local development builds:

make prepare-apk
./gradlew assembleDebug

CI version codes use 1000000 + GITHUB_RUN_NUMBER, independent of branch commit counts. Local builds default to version code 1; set WEBSCRCPY_VERSION_CODE explicitly when building a compatible update to a CI APK. CI builds retain the existing public test certificate; local private signing uses WEBSCRCPY_KEYSTORE and its password/alias environment variables. Do not use the public test key for production distribution. Run make format to format Go and browser sources. Push a version tag from main to publish a release; manual workflow runs only build an APK.

Stop WebScrcpy before updating. CI-signed v1.5 installations can update directly to v1.6 and keep their settings. To upgrade from v1.4, uninstall it first, install the APK with application ID io.github.cedar17.webscrcpy, then grant root and configure startup options. See CHANGELOG.

The Go gateway uses one concrete scrcpy session package and one HTTP/WebSocket service; video dimensions come from the browser decoder. Capture settings use one native HTML form backed by typed server defaults; video bitrate is entered in kbps (4000 = 4 Mbps). Older development builds' string bitrate values are not migrated.

Video playback uses JMuxer 2.1.4 with the local SourceBuffer queue-drain fix; audio uses Opus/WebM. Video uses capture PTS; the audio/video latency option matches live-buffer delay, not sample-accurate PTS synchronization.

All browser pages share the Android service's dark theme, using the actual system dynamic colors (Android 12+) resolved when the service starts. Restart the service after changing the system palette. The browser UI supports English and Chinese. No frontend build is required. When a PIN is set, an unauthenticated WebSocket receives the PIN-required close code before capture starts.

Security and compatibility

HTTP/WS is unencrypted. With PIN left blank, anyone who can reach the service can view and control the device. When a PIN is set, retries are unlimited and authentication lasts two hours for new requests and reconnects. Established streams can continue. Use a trusted private network or secure VPN; never expose this root service directly to the Internet. The APK serves all browser assets locally. The public CI test signing key is not suitable for production distribution; a privately signed release requires uninstalling test-signed APKs first.

Credits and license

Based on huonwe/webscreen and youyoudezhuzhu/webscreen. Capture/control uses scrcpy (Apache-2.0); browser playback uses JMuxer (bundled license). Original copyright notices and AGPL-3.0 remain in effect.

About

Stream your device in your browser via WebRTC

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages