Comments (3)
Hi.
There is no such feature now: all my test devices are connected via USB.
But this can be implemented with little effort (assuming adb on device already listens for a tcp/ip connection).
Worth to notice:
- to connect adb to device over Wi-Fi (on Android 10 and lower) you must connect it with usb first
ws-scrcpy
server detects all connected devices and runsscrcpy-server.jar
on themscrcpy-server.jar
will keep running after device disconnection (not like the original scrcpy), i.e. you still can connect to the stream (if you know ip-address of the device)
from ws-scrcpy.
I finally made it. this is what I try:
In typings/@devicefarmer/adbkit/index.d.ts
, add the following interfaces in AdbKitClient:
export interface AdbKitClient {
//other interfaces
forward(serial: string, local: string, remote: string, callback?: Callback<true>): Promise<true>;
connect(host: string, port?: string, callback?: Callback<string>): Promise<string>; //add this line
disconnect(host: string, port?: string, callback?: Callback<string>): Promise<string>; //add this line as well
}
Then in src/server/Util.ts
, amend the Util.foward()
method. Add the adb connect so it tries to establish a new connection before it searches existing adb forward:
public static async forward(serial: string, remote: string): Promise<number> {
const client = ADB.createClient();
//add following lines
serial = await client.connect(serial);
console.log(`connect to ${serial}`);
//add above lines
const forwards = await client.listForwards(serial);
...
return port;
}
So now I can specify a remote device in the html query:
http://127.0.0.1:8000/#!action=stream&udid=<device host>%3A<device adb port>&decoder=broadway&ip=127.0.0.1&port=8000&query=%3Faction%3Dproxy%26remote%3Dtcp%253A8886%26udid%3D<device host>%253A<device adb port>
But the known issue now is:
how to disconnect the adb automatically when the websocket closes?
Any hint?
from ws-scrcpy.
It would be convenient to add the following actions before this line (not in the forward
method):
Lines 125 to 126 in eb29672
- Check if the device already connected
- If it is not:
2.1 callclient.connect(..)
2.2 addws.onclose = () => { client.disconnect(..); }
P.S. In develop
branch I have complete typings for adbkit
.
from ws-scrcpy.
Related Issues (20)
- REQUEST HELP - With spread action from one to multiple devices
- "createSetClipboardCommand" HOT 2
- issues with Android 14 HOT 8
- 这么传文件啊,就只有浏览器打开adb怎么连接 HOT 2
- unable to start project HOT 4
- TS2344: Type 'TE' does not satisfy the constraint 'EventMap'.
- Not able to use Remotely HOT 1
- Not be able to start app
- [StreamReceiver]. WS closed unexpectedly after a while HOT 1
- Cannot display adb connected devices HOT 1
- can't configure stream HOT 6
- Firefox exhibits lag when using player=mse (H264 Converter)
- can not restart device scrcpy server via adb wifi connection
- Issue with Android 14 display in pixel device HOT 4
- Server exited: [server] ERROR: The server version (2.4) does not match the client (1.19-ws5) HOT 1
- Fixed screen orientation
- Can you support audio with scrcpy
- Android 15 support HOT 2
- termux 安装错误
- ubuntu24 错误
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ws-scrcpy.