Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
drauggres committed Aug 7, 2020
2 parents bf8a56f + 86f768e commit e066fdd
Show file tree
Hide file tree
Showing 91 changed files with 3,157 additions and 2,046 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/public/**/*.js
src/vendor/**/*.js
src/Util.ts
src/h264-live-player/**/*.ts
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"plugins": [
"progress",
"@typescript-eslint",
"prettier"
],
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"progress/activate": 1,
"import/no-absolute-path": "off"
},
"overrides": [
]
}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4
}
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ Web client prototype for [scrcpy](https://github.com/Genymobile/scrcpy).

## Requirements

You'll need a web browser with these technologies support:
You'll need a web browser that supports the following technologies:
* WebSockets
* Media Source Extensions and h264 decoding ([NativeDecoder](/src/decoder/NativeDecoder.ts))
* WebGL ([Broadway.js](/src/decoder/BroadwayDecoder.ts))
* WebWorkers ([h264bsd](/src/decoder/H264bsdDecoder.ts))
* WebAssembly (both [Broadway.js](/src/decoder/BroadwayDecoder.ts) and [h264bsd](/src/decoder/H264bsdDecoder.ts))
* WebWorkers ([h264bsd](/src/decoder/H264bsdDecoder.ts), [tinyh264](/src/decoder/Tinyh264Decoder.ts))
* WebAssembly ([Broadway.js](/src/decoder/BroadwayDecoder.ts) and [h264bsd](/src/decoder/H264bsdDecoder.ts), [tinyh264](/src/decoder/Tinyh264Decoder.ts))

## Build and Start

Expand All @@ -21,18 +20,34 @@ npm start
```

## Supported features
* Screen casting

### Screen casting
The modified [version](https://github.com/NetrisTV/scrcpy/tree/feature/websocket-v1.15.x) of [Genymobile/scrcpy](https://github.com/Genymobile/scrcpy) used to stream H264 video, which then decoded by one of included decoders.

### Remote control
* Touch events (including multi-touch)
* Input events
* Clipboard events
* Multi-touch emulation: <kbd>CTRL</kbd> to start with center at the center of the screen, <kbd>SHIFT</kbd> + <kbd>CTRL</kbd> to start with center at the current point
* Capturing keyboard events
* Injecting text (ASCII only)
* Copy to/from device clipboard
* Device "rotation"
* Video settings changing

### File push
Drag & drop an APK file to push it to the `/data/local/tmp` directory. You can install it manually from the included [xterm.js](https://github.com/xtermjs/xterm.js) terminal emulator.

## Known issues

* The server on the Android Emulator listens on internal interface and not available from the outside (as workaround you can do `adb forward tcp:8886 tcp:8886` and use `127.0.0.1` instead of emulator IP address)
* The server on the Android Emulator listens on the internal interface and not available from the outside (as workaround you can do `adb forward tcp:8886 tcp:8886` and use `127.0.0.1` instead of emulator IP address)
* H264bsdDecoder may fail to start
* Version `0.2.0` is incompatible with previous. Reboot device or manually kill `app_process`.
* Version `0.3.0` is incompatible with previous. Reboot device or manually kill `app_process`.

## Security warning
Be advised and keep in mind:
* There is no encryption between browser and node.js server (plain HTTP).
* There is no encryption between browser and WebSocket server (plain WS).
* There is no authorization on any level.
* The modified version of scrcpy with integrated WebSocket server is listening for connections on all network interfaces.
* The modified version of scrcpy will keep running after the last client disconnected.

## Related projects
* [Genymobile/scrcpy](https://github.com/Genymobile/scrcpy)
Expand All @@ -43,9 +58,10 @@ npm start
* [openstf/adbkit](https://github.com/openstf/adbkit)
* [openstf/adbkit-logcat](https://github.com/openstf/adbkit-logcat)
* [xtermjs/xterm.js](https://github.com/xtermjs/xterm.js)
* [udevbe/tinyh264](https://github.com/udevbe/tinyh264)

## scrcpy websocket fork

Currently support of WebSocket protocol added to v1.13 of scrcpy
* [Prebuilt package](https://github.com/NetrisTV/scrcpy/releases/download/v1.13-ws/scrcpy-server.jar)
* [Source code](https://github.com/NetrisTV/scrcpy/tree/feature/websocket-v1.13)
Currently, support of WebSocket protocol added to v1.15.1 of scrcpy
* [Prebuilt package](/src/public/scrcpy-server.jar)
* [Source code](https://github.com/NetrisTV/scrcpy/tree/feature/websocket-v1.15.x)
1 change: 1 addition & 0 deletions images/multitouch/SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://android.googlesource.com/platform/external/qemu/+/emu-2.0-release/android/skin/qt/images/multitouch/
Binary file added images/multitouch/center_point.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/multitouch/center_point_2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/multitouch/touch_point.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/multitouch/touch_point_2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/skin-light/SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://android.googlesource.com/platform/external/qemu/+/emu-2.0-release/android/skin/qt/images/light/
21 changes: 21 additions & 0 deletions images/skin-light/System_Back_678.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions images/skin-light/System_Home_678.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions images/skin-light/System_Overview_678.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions images/skin-light/ic_keyboard_678_48dp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions images/skin-light/ic_more_horiz_678_48dp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions images/skin-light/ic_photo_camera_678_48dp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions images/skin-light/ic_power_settings_new_678_48px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions images/skin-light/ic_volume_down_678_48px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions images/skin-light/ic_volume_up_678_48px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 20 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
{
"name": "ws-scrcpy",
"version": "0.2.0",
"version": "0.3.0",
"description": "ws client for scrcpy",
"scripts": {
"build": "npm run compile && npm run copy:vendor && npx browserify build/index.js -o build/bundle.js",
"build": "npm run compile && npm run copy:vendor && npm run build:webpack",
"clean": "npm run clean:build && npm run clean:dist",
"clean:build": "npx rimraf build",
"clean:dist": "npx rimraf dist",
"build:webpack": "webpack --config webpack.config.js",
"compile": "npx tsc -p .",
"copy:bundle": "node -e \"fs.copyFile('build/bundle.js','dist/public/bundle.js',function(e){if(e)process.exit(1);process.exit(0);})\"",
"copy:public": "node -e \"require('recursive-copy')('src/public','dist/public', {overwrite: true, debug: true} ,function(e){if(e)process.exit(1);process.exit(0);})\"",
"copy:server": "node -e \"require('recursive-copy')('build/server','dist/server', {overwrite: true, debug: true} ,function(e){if(e)process.exit(1);process.exit(0);})\"",
"copy:vendor": "node -e \"require('recursive-copy')('src/vendor','build', {overwrite: true, debug: true} ,function(e){if(e)process.exit(1);process.exit(0);})\"",
"copy:xterm.css": "node -e \"require('recursive-copy')('node_modules/xterm/css','dist/public', {overwrite: true, debug: true} ,function(e){if(e)process.exit(1);process.exit(0);})\"",
"dist": "npm run build && npm run mkdirs && npm run copy:package.json && npm run copy:public && npm run copy:xterm.css && npm run copy:bundle && npm run copy:server",
"dist": "npm run build && npm run mkdirs && npm run copy:package.json && npm run copy:public && npm run copy:xterm.css && npm run copy:server",
"copy:package.json": "node -e \"const j=require('./package.json');const {name,version,description,author,license,dependencies,scripts}=j; const p={name, version, description,author,license,dependencies}; p.scripts={start: scripts['dist:start']};fs.writeFileSync('./dist/package.json', JSON.stringify(p, null, ' '))\"",
"mkdirs": "npx mkdirp dist/public",
"start": "npm run dist && npm run start:dist",
"start:dist": "cd dist && npm start",
"dist:start": "cd server && node index.js",
"lint": "npx tslint --project .",
"lint": "eslint src/ --ext .ts",
"format": "eslint src/ --fix --ext .ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Sergey Volkov <[email protected]>",
Expand All @@ -34,16 +36,27 @@
"devDependencies": {
"@types/node": "^12.0.2",
"@types/ws": "^6.0.4",
"browserify": "^16.2.3",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"babel-runtime": "^6.26.0",
"buffer": "^5.2.1",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-progress": "0.0.1",
"file-loader": "^6.0.0",
"h264-converter": "^0.1.1",
"mkdirp": "^0.5.1",
"prettier": "^2.0.5",
"recursive-copy": "^2.0.10",
"rimraf": "^3.0.0",
"svg-inline-loader": "^0.8.2",
"sylvester.js": "^0.1.1",
"tslint": "^5.16.0",
"tslint-react": "^4.0.0",
"tinyh264": "0.0.5",
"typescript": "^3.4.5",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12",
"worker-loader": "^2.0.0",
"xterm": "^4.5.0",
"xterm-addon-attach": "^0.5.0",
"xterm-addon-fit": "^0.3.0"
Expand Down
Loading

0 comments on commit e066fdd

Please sign in to comment.