Giter VIP home page Giter VIP logo

ws-scrcpy's Introduction

ws scrcpy

Web client for Genymobile/scrcpy and more.

Requirements

Browser must support the following technologies:

  • WebSockets
  • Media Source Extensions and h264 decoding;
  • WebWorkers
  • WebAssembly

Server:

  • Node.js v10+
  • node-gyp (installation)
  • adb executable must be available in the PATH environment variable

Device:

Build and Start

Make sure you have installed node.js, node-gyp and build tools

git clone https://github.com/NetrisTV/ws-scrcpy.git
cd ws-scrcpy

## For stable version find latest tag and switch to it:
# git tag -l
# git checkout vX.Y.Z

npm install
npm start

Supported features

Android

Screen casting

The modified version of Genymobile/scrcpy used to stream H264-video, which then decoded by one of included decoders:

Mse Player

Based on xevokk/h264-converter. HTML5 Video.
Requires Media Source API and video/mp4; codecs="avc1.42E01E" support. Creates mp4 containers from NALU, received from a device, then feeds them to MediaSource. In theory, it can use hardware acceleration.

Broadway Player

Based on mbebenita/Broadway and 131/h264-live-player.
Software video-decoder compiled into wasm-module. Requires WebAssembly and preferably WebGL support.

TinyH264 Player

Based on udevbe/tinyh264.
Software video-decoder compiled into wasm-module. A slightly updated version of mbebenita/Broadway. Requires WebAssembly, WebWorkers, WebGL support.

WebCodecs Player

Decoding is done by browser built-in (software/hardware) media decoder. Requires WebCodecs support. At the moment, available only in Chromium and derivatives.

Remote control

  • Touch events (including multi-touch)
  • Multi-touch emulation: CTRL to start with center at the center of the screen, SHIFT + CTRL to start with center at the current point
  • Mouse wheel and touchpad vertical/horizontal scrolling
  • Capturing keyboard events
  • Injecting text (ASCII only)
  • Copy to/from device clipboard
  • Device "rotation"

File push

Drag & drop an APK file to push it to the /data/local/tmp directory. You can install it manually from the included xtermjs/xterm.js terminal emulator (see below).

Remote shell

Control your device from adb shell in your browser.

Debug WebPages/WebView

/docs/Devtools.md

File listing

  • List files
  • Upload files by drag & drop
  • Download files

iOS

Experimental Feature: is not built by default (see custom build)

Screen Casting

Requires ws-qvh available in PATH.

MJPEG Server

Enable USE_WDA_MJPEG_SERVER in the build configuration file (see custom build).

Alternative way to stream screen content. It does not require additional software as ws-qvh, but may require more resources as each frame encoded as jpeg image.

Remote control

To control device we use appium/WebDriverAgent. Functionality limited to:

  • Simple touch
  • Scroll
  • Home button click

Make sure you did properly setup WebDriverAgent. WebDriverAgent project is located under node_modules/appium-webdriveragent/.

You might want to enable AssistiveTouch on your device: Settings/General/Accessibility.

Custom Build

You can customize project before build by overriding the default configuration in build.config.override.json:

  • INCLUDE_APPL - include code for iOS device tracking and control
  • INCLUDE_GOOG - include code for Android device tracking and control
  • INCLUDE_ADB_SHELL - remote shell for android devices (xtermjs/xterm.js, Tyriar/node-pty)
  • INCLUDE_DEV_TOOLS - dev tools for web pages and web views on android devices
  • INCLUDE_FILE_LISTING - minimalistic file management
  • USE_BROADWAY - include Broadway Player
  • USE_H264_CONVERTER - include Mse Player
  • USE_TINY_H264 - include TinyH264 Player
  • USE_WEBCODECS - include WebCodecs Player
  • USE_WDA_MJPEG_SERVER - configure WebDriverAgent to start MJPEG server
  • USE_QVH_SERVER - include support for ws-qvh
  • SCRCPY_LISTENS_ON_ALL_INTERFACES - WebSocket server in scrcpy-server.jar will listen for connections on all available interfaces. When true, it allows connecting to device directly from a browser. Otherwise, the connection must be established over adb.

Run configuration

You can specify a path to a configuration file in WS_SCRCPY_CONFIG environment variable.

If you want to have another pathname than "/" you can specify it in the WS_SCRCPY_PATHNAME environment variable.

Configuration file format: Configuration.d.ts.

Configuration file example: config.example.yaml.

Known issues

  • The server on the Android Emulator listens on the internal interface and not available from the outside. Select proxy over adb from the interfaces list.
  • TinyH264Player may fail to start, try to reload the page.
  • MsePlayer reports too many dropped frames in quality statistics: needs further investigation.
  • On Safari file upload does not show progress (it works in one piece).

Security warning

Be advised and keep in mind:

  • There is no encryption between browser and node.js server (you can configure HTTPS).
  • There is no encryption between browser and WebSocket server on android device.
  • There is no authorization on any level.
  • The modified version of scrcpy with integrated WebSocket server is listening for connections on all network interfaces (see custom build).
  • The modified version of scrcpy will keep running after the last client disconnected.

Related projects

scrcpy websocket fork

Currently, support of WebSocket protocol added to v1.19 of scrcpy

ws-scrcpy's People

Contributors

bitefoo avatar dependabot[bot] avatar drauggres avatar larserik avatar lizilong-1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ws-scrcpy's Issues

Controlling video/canvas size

Cloud not find a way to control video/screen size in code. I did change each decoder bounds: new Size(720, 720),
nothing changed video/canvas is very small.

Mobile did not display on Web page

The service run successfully, but the terminal display "error: failed to start server". And the mobile screen can not display on web page after I click Native stream hyperlink. How can I fix it? Can someone help me, please?
Terminal error msg
ๆ“ทๅ–2

Web page display like below pic
ๆ“ทๅ–

Different network Issue

When I am trying the access device display and control on different network then it is not working.Can you please suggest it How can I resolve this issue

use of ethernet ip not possible

switched my devices to a 64bit OS, which has no longer support for wifi chip
devices connected now via ethernet

there is no way to stream, as only wifi ip is used
ethernet ip , if present, should be used as first option, even when wifi is present

How to change default screen size?

Hi master @drauggres ,

The default screen size of the width is 208px and the height is 480px when I launch native decoder.
How do I modify the script to change default screen size to bigger? (not using click "Change video settings" button to make screen bigger than default)
Thanks!

Only works with localhost

When Android device is not connected to internet and adb forward is done(as recommended workaround), Does not work with system IP only works with local host. "ERR_CONNECTION_REFUSED" is received in browser

Drag & Drop begins but does not proceed further

Tried to drag and drop an APK file to connected device. It shows the "begin..." message but does not proceed any further. I tried introducing logs to see where it gets stuck and it seems its stuck waiting for response in the below code snippet.

Commit: Master 5f0881c

Code Snippet (lines 65-71):

File: FilePushHandler.ts

    this.sendUpdate({ pushId: id, fileName, logString: 'begin...', error: false });
    const newParams = { id, state: FilePushState.NEW };
    this.connection.sendEvent(CommandControlEvent.createPushFileCommand(newParams));
    const pushId: number = await this.waitForResponse(id); // gets stuck here
    if (pushId <= 0) {
        this.logError(pushId, fileName, pushId);
    }

Not sure if I'm missing something here. The APK file size is relatively small (111 KB), so I hope the file size should not be causing this. This issue is reproducible in at least couple of devices from different vendors. (OnePlus 7 being one)

Also tried with different APKs and checked if the file was uploaded to public folder. No luck there as well.

Cant Get Stream / Crashes

Hello, ive been trying to figure out how to get this project running but it seems to fail over and over.

i dont know if i installed something wrong and im doing it wrong

Im using a Stock Pixel 3

So here is the situation

I run Npm start and it all goes well i get the list of the paths

and i get this screen on my browser

1

then i go into cmd, go to my adb folder in Android SDK and run the adb connect command

i get this image but no options

2

so i run and adb disconnect command i get this

3

But nothing happens when i click the options, only a blank screen, so i do an adb connect again

and im still not getting anything.

4

now you might be asking why am i doing it this way, and its because in previous version that i used for testing, one of the options had a logcat option, the only way to get that working was with this steps
1- adb connect - See device on list
2- adb disconnect - select logcat option from list
3- adb connect again, refresh logcat page working logcats
4- crashes after 5-10 seconds

Now i tried the following as well
1- adb connect - See device on list
2- adb forward tcp:8886 tcp:8886
3- 127.0.0.1 host
4- same issue and sometimes it crashes

Thank you for you time.

Crash log file.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\creyesd\Desktop\ws-scrcpy-master\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\creyesd\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Autodesk\Backburner\;C:\Users\creyesd\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Brackets\command;C:\Program Files (x86)\Plantronics\Spokes3G\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\creyesd\.windows-build-tools\python27\;C:\Python38\Scripts\;C:\Python38\;C:\Users\creyesd\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\creyesd\AppData\Local\Programs\Python\Python38-32\;C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby2.2.0\bin;C:\Users\creyesd\AppData\Local\Microsoft\WindowsApps;C:\Users\creyesd\AppData\Local\GitHubDesktop\bin;C:\ProgramData\creyesd\atom\bin;C:\Users\creyesd\AppData\Local\atom\bin;C:\Users\creyesd\AppData\Local\Polycom\RealPresence Desktop\;C:\Users\creyesd\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\creyesd\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\Users\creyesd\Desktop\ws-scrcpy-master
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'npm run dist && npm run start:dist' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `npm run dist && npm run start:dist`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\creyesd\Desktop\ws-scrcpy-master
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v14.3.0
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `npm run dist && npm run start:dist`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Memu emulator stream not working

Windows 10 x64, ws-scrcpy 0.6.1

I try to stream from memu emulator but it gives me error like this :

err

and broadway,MSE, tinyh264 colums is empty

adb forward tcp:8886 tcp:8886 -> does not work

Connection via Mobile data interface

Hi,

I have tried it is working fine with wifi but when I have forwarded port with wifi connectivity it is working fine but if the connectivity on mobile data that time ws://undefined:8886/ then it is not working.So can you please give me idea.
Screen Shot 2020-04-17 at 11 45 15 AM

Only MseDecoder can work, other decoders display black screen.

As title, only native decoder can work in my environment, the other three decoder display black screen after I launch the web page.
Can someone help to check this out?

Chrome version: 83.0.4103.116
Desktop OS: Windows 10
NPM version: 6.14.5
NODE version: 8.17.0

[Feature Request/Enhancement] Pulling files from device

Similar to how the the server allows users to push APK files to a fixed location within the device, a valid use case would be to pull files from the same location by exposing the directory contents. (Would be /data/local/tmp)

Using Xterm shell, users can move desired files to the location and download them from dashboard.

Found 1 error while running "npx tsc -p . "

C:\Users\Hussain\Desktop\ws-scrcpy>npx tsc -p .
src/h264-live-player/WebGLCanvas.ts:226:13 - error TS2322: Type 'CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext | null' is not assignable to type 'WebGLRenderingContext | null | undefined'.
Type 'CanvasRenderingContext2D' is missing the following properties from type 'WebGLRenderingContext': drawingBufferHeight, drawingBufferWidth, activeTexture, attachShader, and 429 more.

226 this.gl = this.canvas.getContext('experimental-webgl');
~~~~~~~

Devices support scrcpy -m2048

some devices support working only if mentioned as --

scrcpy -m2048

How to handle this situation in ws-scrcpy. can it do it automatically?

[Feature Request/Enhancement] Screen Capture

While screenshots are already allowed, it would be good to record the screen output and download the video stream until the user stops the recording. If that brings some overhead, we can specify duration of screen capture to X seconds or have a configurable threshold in the control pane.

Right now, this is possible using third party or 1P solutions (in Mac), but its counter intuitive when it comes to cropping/resizing to match the exact feed dimensions.

Error: Cannot find module '../server/websocket.js'

I got this error on Ubuntu14 and Mac OS, does anyone seem this error before?

> cd public && npx ws --websocket ../server/websocket.js --spa index.html

Error: Cannot find module '../server/websocket.js'
    at Function.Module._resolveFilename (module.js:513:15)
    at Function.resolve (internal/module.js:18:19)
    at loadModule (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/load-module/index.js:45:32)
    at Lws.attachWebsocket (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/lws/index.js:140:62)
    at Lws.listen (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/lws/index.js:77:12)
    at WsServe.execute (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/lws/lib/command/serve.js:296:26)
    at WsServe.execute (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/local-web-server/lib/command/serve.js:11:18)
    at Map.start (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/cli-commands/index.js:26:18)
    at WsCliApp.start (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/lws/lib/cli-app.js:9:26)
    at Function.run (/media/psf/Home/wwwroot/ws-scrcpy/node_modules/lws/lib/cli-app.js:15:29)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `cd public && npx ws --websocket ../server/websocket.js --spa index.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:

ServerDeviceConnection error (Window version with fix/win)

Now I am try to show my target by web, for this I found this solution in Git.
it's Good for me but I met some issue like under comments.

dbug ADB Running 'D:\Android\Sdk\platform-tools\adb.exe -P 5037 -s R39KC04P6W shell 'ip route|grep wlan0|grep -v default''
ERR! ServerDeviceConnection Error: Command 'D:\Android\Sdk\platform-tools\adb.exe -P 5037 -s R39KC04P6W shell 'ip route|grep wlan0|grep -v default'' exited with code 1
ERR! ServerDeviceConnection at ChildProcess.proc.on.code (D:\Work\tmp\ws-scrcpy-fix-win\ws-scrcpy-fix-win\node_modules\teen_process\lib\exec.js:113:19)
ERR! ServerDeviceConnection at ChildProcess.emit (events.js:198:13)
ERR! ServerDeviceConnection at maybeClose (internal/child_process.js:982:16)
ERR! ServerDeviceConnection at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
ERR! ServerDeviceConnection Error: Command 'D:\Android\Sdk\platform-tools\adb.exe -P 5037 -s R38KA0JHAHA shell 'ip route|grep wlan0|grep -v default'' exited with code 1
ERR! ServerDeviceConnection at ChildProcess.proc.on.code (D:\Work\tmp\ws-scrcpy-fix-win\ws-scrcpy-fix-win\node_modules\teen_process\lib\exec.js:113:19)
ERR! ServerDeviceConnection at ChildProcess.emit (events.js:198:13)
ERR! ServerDeviceConnection at maybeClose (internal/child_process.js:982:16)
ERR! ServerDeviceConnection at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

Could you help me for this issue?

Hi, how can I connect to a remote android device?

It seems I have to run the adb connect <host>:<port> on the server host to enable the connection every time. Is there a way to auto connect to the device by inputing the device host and port in the form of query?

So is like, http://127:0.0.1:8000/?...&host=<device host>&port=<device port>..., to auto adb the remote device and get the stream.

Is it possible?

where can I find which api is calling touch and sendKey event

can you please point me to right direction in finding functions for touches and tap events to devices

found below info but couldnt find where touch command is sent to device

 public sendEvent(e: ControlMessage): void {
        console.log("sendEvent : "+e)
        this.streamReceiver.sendEvent(e);
    }
 public sendEvent(event: ControlMessage): void {
        if (this.hasConnection()) {
            (this.ws as WebSocket).send(event.toBuffer());
        } else {
            this.events.push(event);
        }
    }

Thanks

error...

dbug ADB Getting connected devices... dbug ADB Connected devices: [{"udid":"77.77.77.9:5555","state":"device"}] dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell 'ip route|grep eth0|grep -v default'' dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell getprop ro.product.model' dbug ADB Current device property 'ro.product.model': SM-G970N dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell getprop ro.product.manufacturer' dbug ADB Current device property 'ro.product.manufacturer': samsung dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell 'for a in find /proc -type d -maxdepth 1 -user shell -group shell 2>/dev/null; do test -f "$a/cmdline" && grep -av find "$a/cmdline" |grep -sa scrcpy 2>&1 > /dev/null && echo $a |cut -d "/" -f 3; done; exit 0'' info ServerDeviceConnection [77.77.77.9:5555] PIDs: [] dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell mkdir -p /data/local' dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 push /root/ws-scrcpy/dist/public/scrcpy-server.jar /data/local/tmp/' dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell 'CLASSPATH=/data/local/tmp/scrcpy-server.jar nohup app_process / com.genymobile.scrcpy.Server 0 8000000 false - false true web >/dev/null&'' ERR! ServerDeviceConnection Error: Command '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell 'CLASSPATH=/data/local/tmp/scrcpy-server.jar nohup app_process / com.genymobile.scrcpy.Server 0 8000000 false - false true web >/dev/null&'' timed out after 20000ms ERR! ServerDeviceConnection at Timeout.setTimeout (/root/ws-scrcpy/node_modules/teen_process/lib/exec.js:125:19) ERR! ServerDeviceConnection at ontimeout (timers.js:436:11) ERR! ServerDeviceConnection at tryOnTimeout (timers.js:300:5) ERR! ServerDeviceConnection at listOnTimeout (timers.js:263:5) ERR! ServerDeviceConnection at Timer.processTimers (timers.js:223:10)

I don't know why...
looks like
dbug ADB Running '/opt/androidSdk/platform-tools/adb -P 5037 -s 77.77.77.9\:5555 shell 'CLASSPATH=/data/local/tmp/scrcpy-server.jar nohup app_process / com.genymobile.scrcpy.Server 0 8000000 false - false true web >/dev/null&''
this is error

android client without nodejs server

Hello
I'm building a ws-scrcpy android client, but i have problem when i try to connect to the web socket.
when i use for example the ffplay binary to test the stream i get:

[http @ 00000241da680540] HTTP error 404 WebSocket Upgrade Failure
http://192.168.1.9:8886: Server returned 404 Not Found

how can i access the stream without nodejs server?

as i understand the server need to get a socket request from client with a magic string to accept the connection.

Thank you for this project.

LDPlayer4

`> [email protected] start /root/ws-scrcpy1.13/dist

cd server && node index.js

[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] error: failed to start server
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] error: failed to start server
(node:6819) UnhandledPromiseRejectionWarning: TypeError: First argument must be a valid error code number
at Sender.close (/root/ws-scrcpy1.13/node_modules/ws/lib/sender.js:108:13)
at WebSocket.close (/root/ws-scrcpy1.13/node_modules/ws/lib/websocket.js:229:18)
at WebSocketServer.wss.on (/root/ws-scrcpy1.13/dist/server/index.js:82:16)
at WebSocketServer.emit (events.js:198:13)
at handleUpgrade (/root/ws-scrcpy1.13/node_modules/ws/lib/websocket-server.js:90:18)
at WebSocketServer.completeUpgrade (/root/ws-scrcpy1.13/node_modules/ws/lib/websocket-server.js:329:5)
at WebSocketServer.handleUpgrade (/root/ws-scrcpy1.13/node_modules/ws/lib/websocket-server.js:245:10)
at Server.upgrade (/root/ws-scrcpy1.13/node_modules/ws/lib/websocket-server.js:89:16)
at Server.emit (events.js:198:13)
at onParserExecuteCommon (_http_server.js:567:14)
at onParserExecute (_http_server.js:513:3)
(node:6819) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6819) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] Result:
[77.77.77.9:5555] error: failed to start server
`

I go to http://77.77.77.31:8000/ it have show a list
but in stream didn't show anything...
http://77.77.77.31:8000/#!showFps=true&action=stream&udid=77.77.77.9%3A5555&decoder=broadway&ip=&port=8887
http://77.77.77.31:8000/#!showFps=true&action=stream&udid=77.77.77.9%3A5555&decoder=native&ip=&port=8887
http://77.77.77.31:8000/#!showFps=true&action=stream&udid=77.77.77.9%3A5555&decoder=h264bsd&ip=&port=8887
all show white page

Remote control not working?

Thank you for this wonderful lib. All is working except remote control. I'm on a mac (Catalina) running the latest chrome (as a viewer)
and Ubunto 20.04 running on Raspberry Pi 4 as server-side (tunneling thru NgRok). What can be wrong?

show touches or tap

can you add show touches and tap and change mouse to hand image instead of mouse-pointer

Run in nodejs v12.8.0

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/yewang/data/project/xbw/ws-scrcpy/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/yewang/Library/Android/sdk/platform-tools
9 verbose lifecycle [email protected]~start: CWD: /Users/yewang/data/project/xbw/ws-scrcpy
10 silly lifecycle [email protected]~start: Args: [ '-c', 'npm run dist && cd dist && npm start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `npm run dist && cd dist && npm start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/yewang/data/project/xbw/ws-scrcpy
16 verbose Darwin 18.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v8.4.0
19 verbose npm  v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `npm run dist && cd dist && npm start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

[NativeDecoder] Playback stops after settings changing

Hi master,

Now I got another question that after I clicked Native Decoder stream link and change video setting, the device stream had started, but after few seconds, the stream had stop... How can I fix it? Thanks!

No stream is displayed: windows Server 2016, Android 8.1

Hi,

after successful starting the frontend , no stream (any decoder) is starting
Listening on: http://xyz:8000 http://[xxx:xx:xxxx:xxxx:xxx]:8000 http://xx.xx.xx.xx:8000 http://[::1]:8000 http://127.0.0.1:8000
[xx.xx.xx.xx:5555] failed to spawn adb process spawn adb ENOENT
Error: spawn adb ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
[xx.xx.xx.xx:5555] adb process (-s xx.xx.xx.xx:5555 shell CLASSPATH=/data/local/tmp/scrcpy-server.jar nohup app_process / com.genymobile.scrcpy.Server 1.16-ws1 ERROR 0 8000000 60 -1 false - false true 0 false false - web 8886 2>&1 > /dev/null) exited with code -4058
[xx.xx.xx.xx:5555] error: failed to start server

http://127.0.0.1:8000/#!action=stream&udid=xx.xx.xx.xx%3A5555&decoder=broadway&ip=xx.xx.xx.xx&port=8886

  • windows server 2016
  • node.js v12.18.4
  • Chrome 85.0.4183.102 (Offizieller Build) (32-Bit)
  • scrcpy-win64-v1.16 is working fine with adb over tcp
  • Android 8.1, SDK 27, wifi is on

Do you have any suggestions?

Thanks

How to modify for my use case?

Is the below modification for my use case possible and what would be the to-do list of steps and/or needed research?

What current project does:
Allows a real android device to be connected to a viewer device.
Allows installing an apk onto the real device copied from the viewer device, show the screen of the real android device on the viewer device, and send UI events from the viewer device to the real device's handlers.
The devices can be wired together via USB or wireless if both connected to the same wifi network.
The project's UI (client) running on the viewer device installs the project's jar/apk (server) onto the real device. Therefore the server is only needed for Android OS. The client [where original scrscpy is available in Win/Mac/Linux binaries] is Chrome for Windows or any Chrome?

What my use case needs:
Allows a real android device (Android VR Headset) to be connected to a viewer device (Desktop or Tablet).
Allows installing an apk onto the real device copied from the viewer device, show the screen of the real android device (only one eye) on the viewer device, and (bonus) send UI events from the viewer device to the real device's handlers.
The devices will be wired together via USB. A wifi network does not exist in the field, but if absolutely required to achieve our goals, could be provided.
The project's UI (client) running on the viewer device installs the project's jar/apk (server) onto the real device. Therefore the server is only needed for Android OS. The client is ideally coded in a web codebase for Electron to make win/mac/linux chromium binaries and for Cordova to make iOS/android binaries.

android emulator from server, accessible from public

currently i am developing something like remote android through browser with emulated android run on it, while in localhost i am able to control and view to browser, does it possible the browser mirrored to public view?? while trying to access ip from another computer i just cannot make it works

Build latest version failed

Hi @drauggres master,

After I clone the latest version(v0.5) and build the service, it failed..
Can you help to check what is the problem?
Thanks!

    ERROR in ./vendor/Genymobile/scrcpy/scrcpy-server.jar 1:2
    Module parse failed: Unexpected character '' (1:2)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders     
    (Source code omitted for this binary file)
     @ ./src/server/ServerDeviceConnection.ts 5:0-59
     @ ./src/server/ServiceDeviceTracker.ts
     @ ./src/server/index.ts

    ERROR in ./vendor/Genymobile/scrcpy/LICENSE.txt 2:40
    Module parse failed: Unexpected token (2:40)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders     
    |
    >                                  Apache License
    |                            Version 2.0, January 2004
    |                         http://www.apache.org/licenses/
     @ ./src/server/ServerDeviceConnection.ts 6:0-53
     @ ./src/server/ServiceDeviceTracker.ts
     @ ./src/server/index.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build:webpack: `webpack --config webpack.ws-scrcpy.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build:webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jess.chu\AppData\Roaming\npm-cache\_logs\2020-10-08T10_14_17_594Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] dist: `npm run build:webpack && npm run copy:package.json && npm run copy:license`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jess.chu\AppData\Roaming\npm-cache\_logs\2020-10-08T10_14_17_637Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] start: `npm run dist && npm run start:dist`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jess.chu\AppData\Roaming\npm-cache\_logs\2020-10-08T10_14_17_670Z-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.