@yume-chan/scrcpy 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +21 -3
- package/CHANGELOG.md +13 -4
- package/LICENSE +1 -1
- package/README.md +41 -24
- package/bin/scrcpy-server +0 -0
- package/bin/version.d.ts +1 -1
- package/bin/version.js +1 -1
- package/esm/adb/client.d.ts +15 -14
- package/esm/adb/client.d.ts.map +1 -1
- package/esm/adb/client.js +66 -41
- package/esm/adb/client.js.map +1 -1
- package/esm/adb/connection.d.ts +16 -7
- package/esm/adb/connection.d.ts.map +1 -1
- package/esm/adb/connection.js +21 -13
- package/esm/adb/connection.js.map +1 -1
- package/esm/adb/options/1_16.d.ts +4 -4
- package/esm/adb/options/1_16.d.ts.map +1 -1
- package/esm/adb/options/1_16.js +2 -2
- package/esm/adb/options/1_16.js.map +1 -1
- package/esm/adb/options/1_22.d.ts +4 -4
- package/esm/adb/options/1_22.d.ts.map +1 -1
- package/esm/adb/options/1_22.js +2 -2
- package/esm/adb/options/1_22.js.map +1 -1
- package/esm/adb/options/types.d.ts +10 -9
- package/esm/adb/options/types.d.ts.map +1 -1
- package/esm/adb/options/types.js +11 -4
- package/esm/adb/options/types.js.map +1 -1
- package/esm/control/back-or-screen-on.d.ts +3 -0
- package/esm/control/back-or-screen-on.d.ts.map +1 -0
- package/esm/control/back-or-screen-on.js +2 -0
- package/esm/control/back-or-screen-on.js.map +1 -0
- package/esm/control/hover-helper.d.ts +18 -0
- package/esm/control/hover-helper.d.ts.map +1 -0
- package/esm/control/hover-helper.js +44 -0
- package/esm/control/hover-helper.js.map +1 -0
- package/esm/control/index.d.ts +11 -7
- package/esm/control/index.d.ts.map +1 -1
- package/esm/control/index.js +11 -7
- package/esm/control/index.js.map +1 -1
- package/esm/control/inject-keycode.d.ts +12 -4
- package/esm/control/inject-keycode.d.ts.map +1 -1
- package/esm/control/inject-keycode.js +15 -7
- package/esm/control/inject-keycode.js.map +1 -1
- package/esm/control/inject-scroll.d.ts +3 -0
- package/esm/control/inject-scroll.d.ts.map +1 -0
- package/esm/control/inject-scroll.js +2 -0
- package/esm/control/inject-scroll.js.map +1 -0
- package/esm/control/inject-text.d.ts +2 -2
- package/esm/control/inject-text.d.ts.map +1 -1
- package/esm/control/inject-touch.d.ts +12 -4
- package/esm/control/inject-touch.d.ts.map +1 -1
- package/esm/control/inject-touch.js +44 -11
- package/esm/control/inject-touch.js.map +1 -1
- package/esm/control/rotate-device.d.ts +2 -2
- package/esm/control/rotate-device.d.ts.map +1 -1
- package/esm/control/serializer.d.ts +22 -11
- package/esm/control/serializer.d.ts.map +1 -1
- package/esm/control/serializer.js +32 -26
- package/esm/control/serializer.js.map +1 -1
- package/esm/control/set-clipboard.d.ts +3 -0
- package/esm/control/set-clipboard.d.ts.map +1 -0
- package/esm/control/set-clipboard.js +2 -0
- package/esm/control/set-clipboard.js.map +1 -0
- package/esm/control/set-screen-power-mode.d.ts +2 -2
- package/esm/control/set-screen-power-mode.d.ts.map +1 -1
- package/esm/device-message/ack-clipboard.d.ts +9 -0
- package/esm/device-message/ack-clipboard.d.ts.map +1 -0
- package/esm/device-message/ack-clipboard.js +6 -0
- package/esm/device-message/ack-clipboard.js.map +1 -0
- package/esm/device-message/clipboard.d.ts +3 -3
- package/esm/device-message/clipboard.d.ts.map +1 -1
- package/esm/device-message/clipboard.js +4 -4
- package/esm/device-message/clipboard.js.map +1 -1
- package/esm/device-message/index.d.ts +4 -3
- package/esm/device-message/index.d.ts.map +1 -1
- package/esm/device-message/index.js +4 -3
- package/esm/device-message/index.js.map +1 -1
- package/esm/device-message/stream.d.ts +4 -3
- package/esm/device-message/stream.d.ts.map +1 -1
- package/esm/device-message/stream.js +8 -4
- package/esm/device-message/stream.js.map +1 -1
- package/esm/options/1_16/codec-options.d.ts +3 -2
- package/esm/options/1_16/codec-options.d.ts.map +1 -1
- package/esm/options/1_16/codec-options.js +6 -7
- package/esm/options/1_16/codec-options.js.map +1 -1
- package/esm/options/1_16/h264-configuration.d.ts +49 -0
- package/esm/options/1_16/h264-configuration.d.ts.map +1 -0
- package/esm/options/1_16/h264-configuration.js +414 -0
- package/esm/options/1_16/h264-configuration.js.map +1 -0
- package/esm/options/1_16/index.d.ts +4 -3
- package/esm/options/1_16/index.d.ts.map +1 -1
- package/esm/options/1_16/index.js +4 -3
- package/esm/options/1_16/index.js.map +1 -1
- package/esm/options/1_16/options.d.ts +17 -20
- package/esm/options/1_16/options.d.ts.map +1 -1
- package/esm/options/1_16/options.js +51 -49
- package/esm/options/1_16/options.js.map +1 -1
- package/esm/options/1_16/scroll.d.ts +27 -0
- package/esm/options/1_16/scroll.d.ts.map +1 -0
- package/esm/options/1_16/scroll.js +56 -0
- package/esm/options/1_16/scroll.js.map +1 -0
- package/esm/options/1_16/sps.d.ts +1 -1
- package/esm/options/1_16/sps.d.ts.map +1 -1
- package/esm/options/1_16/sps.js +25 -17
- package/esm/options/1_16/sps.js.map +1 -1
- package/esm/options/1_18.d.ts +6 -6
- package/esm/options/1_18.d.ts.map +1 -1
- package/esm/options/1_18.js +5 -5
- package/esm/options/1_18.js.map +1 -1
- package/esm/options/1_21.d.ts +12 -1
- package/esm/options/1_21.d.ts.map +1 -1
- package/esm/options/1_21.js +14 -3
- package/esm/options/1_21.js.map +1 -1
- package/esm/options/1_22/index.d.ts +3 -0
- package/esm/options/1_22/index.d.ts.map +1 -0
- package/esm/options/1_22/index.js +3 -0
- package/esm/options/1_22/index.js.map +1 -0
- package/esm/options/{1_22.d.ts → 1_22/options.d.ts} +4 -15
- package/esm/options/1_22/options.d.ts.map +1 -0
- package/esm/options/{1_22.js → 1_22/options.js} +5 -9
- package/esm/options/1_22/options.js.map +1 -0
- package/esm/options/1_22/scroll.d.ts +17 -0
- package/esm/options/1_22/scroll.d.ts.map +1 -0
- package/esm/options/1_22/scroll.js +15 -0
- package/esm/options/1_22/scroll.js.map +1 -0
- package/esm/options/1_23.d.ts +3 -3
- package/esm/options/1_23.d.ts.map +1 -1
- package/esm/options/1_23.js +7 -6
- package/esm/options/1_23.js.map +1 -1
- package/esm/options/1_25/index.d.ts +3 -0
- package/esm/options/1_25/index.d.ts.map +1 -0
- package/esm/options/1_25/index.js +3 -0
- package/esm/options/1_25/index.js.map +1 -0
- package/esm/options/1_25/options.d.ts +6 -0
- package/esm/options/1_25/options.d.ts.map +1 -0
- package/esm/options/1_25/options.js +8 -0
- package/esm/options/1_25/options.js.map +1 -0
- package/esm/options/1_25/scroll.d.ts +19 -0
- package/esm/options/1_25/scroll.d.ts.map +1 -0
- package/esm/options/1_25/scroll.js +33 -0
- package/esm/options/1_25/scroll.js.map +1 -0
- package/esm/options/index.d.ts +5 -4
- package/esm/options/index.d.ts.map +1 -1
- package/esm/options/index.js +5 -4
- package/esm/options/index.js.map +1 -1
- package/esm/options/types.d.ts +14 -12
- package/esm/options/types.d.ts.map +1 -1
- package/esm/options/types.js +6 -4
- package/esm/options/types.js.map +1 -1
- package/package.json +19 -12
- package/scripts/fetch-server.cjs +19 -9
- package/src/adb/client.ts +142 -89
- package/src/adb/connection.ts +77 -30
- package/src/adb/options/1_16.ts +13 -6
- package/src/adb/options/1_22.ts +12 -6
- package/src/adb/options/types.ts +34 -14
- package/src/control/back-or-screen-on.ts +4 -0
- package/src/control/hover-helper.ts +56 -0
- package/src/control/index.ts +11 -7
- package/src/control/inject-keycode.ts +23 -10
- package/src/control/inject-scroll.ts +4 -0
- package/src/control/inject-touch.ts +58 -14
- package/src/control/serializer.ts +106 -41
- package/src/control/set-clipboard.ts +4 -0
- package/src/device-message/ack-clipboard.ts +10 -0
- package/src/device-message/clipboard.ts +8 -8
- package/src/device-message/index.ts +4 -3
- package/src/device-message/stream.ts +17 -7
- package/src/options/1_16/codec-options.ts +17 -10
- package/src/options/1_16/h264-configuration.ts +485 -0
- package/src/options/1_16/index.ts +4 -3
- package/src/options/1_16/options.ts +175 -130
- package/src/options/1_16/scroll.ts +76 -0
- package/src/options/1_18.ts +22 -12
- package/src/options/1_21.ts +31 -13
- package/src/options/1_22/index.ts +2 -0
- package/src/options/{1_22.ts → 1_22/options.ts} +8 -17
- package/src/options/1_22/scroll.ts +26 -0
- package/src/options/1_23.ts +32 -20
- package/src/options/1_25/index.ts +2 -0
- package/src/options/1_25/options.ts +12 -0
- package/src/options/1_25/scroll.ts +52 -0
- package/src/options/index.ts +5 -4
- package/src/options/types.ts +34 -17
- package/tsconfig.build.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/decoder/index.d.ts +0 -28
- package/esm/decoder/index.d.ts.map +0 -1
- package/esm/decoder/index.js +0 -2
- package/esm/decoder/index.js.map +0 -1
- package/esm/decoder/tinyh264/index.d.ts +0 -20
- package/esm/decoder/tinyh264/index.d.ts.map +0 -1
- package/esm/decoder/tinyh264/index.js +0 -86
- package/esm/decoder/tinyh264/index.js.map +0 -1
- package/esm/decoder/tinyh264/worker.d.ts +0 -2
- package/esm/decoder/tinyh264/worker.d.ts.map +0 -1
- package/esm/decoder/tinyh264/worker.js +0 -3
- package/esm/decoder/tinyh264/worker.js.map +0 -1
- package/esm/decoder/tinyh264/wrapper.d.ts +0 -21
- package/esm/decoder/tinyh264/wrapper.d.ts.map +0 -1
- package/esm/decoder/tinyh264/wrapper.js +0 -74
- package/esm/decoder/tinyh264/wrapper.js.map +0 -1
- package/esm/decoder/types.d.ts +0 -2
- package/esm/decoder/types.d.ts.map +0 -1
- package/esm/decoder/types.js +0 -2
- package/esm/decoder/types.js.map +0 -1
- package/esm/decoder/web-codecs/index.d.ts +0 -22
- package/esm/decoder/web-codecs/index.d.ts.map +0 -1
- package/esm/decoder/web-codecs/index.js +0 -81
- package/esm/decoder/web-codecs/index.js.map +0 -1
- package/esm/options/1_22.d.ts.map +0 -1
- package/esm/options/1_22.js.map +0 -1
- package/src/options/1_16/sps.ts +0 -300
- package/tsconfig.test.tsbuildinfo +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yume-chan/scrcpy",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.0.18",
|
|
6
|
+
"tag": "@yume-chan/scrcpy_v0.0.18",
|
|
7
|
+
"date": "Wed, 25 Jan 2023 21:33:49 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Move `@yume-chan/adb` to `peerDependencies`"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"comment": "Add support for Scrcpy server version 1.25"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Add support for `SetClipboard` control message and `AckClipboard` device message"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
4
22
|
{
|
|
5
23
|
"version": "0.0.17",
|
|
6
24
|
"tag": "@yume-chan/scrcpy_v0.0.17",
|
|
@@ -56,7 +74,7 @@
|
|
|
56
74
|
"comments": {
|
|
57
75
|
"none": [
|
|
58
76
|
{
|
|
59
|
-
"comment": "Add support for
|
|
77
|
+
"comment": "Add support for Scrcpy server version 1.24"
|
|
60
78
|
}
|
|
61
79
|
]
|
|
62
80
|
}
|
|
@@ -68,7 +86,7 @@
|
|
|
68
86
|
"comments": {
|
|
69
87
|
"none": [
|
|
70
88
|
{
|
|
71
|
-
"comment": "Add support for 1.23"
|
|
89
|
+
"comment": "Add support for Scrcpy server version 1.23"
|
|
72
90
|
}
|
|
73
91
|
]
|
|
74
92
|
}
|
|
@@ -86,7 +104,7 @@
|
|
|
86
104
|
"comments": {
|
|
87
105
|
"none": [
|
|
88
106
|
{
|
|
89
|
-
"comment": "Add support for 1.22
|
|
107
|
+
"comment": "Add support for Scrcpy server version 1.22"
|
|
90
108
|
},
|
|
91
109
|
{
|
|
92
110
|
"comment": "Update to use Web Streams API"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# Change Log - @yume-chan/scrcpy
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 25 Jan 2023 21:33:49 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.0.18
|
|
6
|
+
Wed, 25 Jan 2023 21:33:49 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Move `@yume-chan/adb` to `peerDependencies`
|
|
11
|
+
- Add support for Scrcpy server version 1.25
|
|
12
|
+
- Add support for `SetClipboard` control message and `AckClipboard` device message
|
|
4
13
|
|
|
5
14
|
## 0.0.17
|
|
6
15
|
Tue, 18 Oct 2022 09:32:30 GMT
|
|
@@ -32,14 +41,14 @@ Sat, 30 Apr 2022 14:05:48 GMT
|
|
|
32
41
|
|
|
33
42
|
### Updates
|
|
34
43
|
|
|
35
|
-
- Add support for
|
|
44
|
+
- Add support for Scrcpy server version 1.24
|
|
36
45
|
|
|
37
46
|
## 0.0.13
|
|
38
47
|
Thu, 28 Apr 2022 01:23:53 GMT
|
|
39
48
|
|
|
40
49
|
### Updates
|
|
41
50
|
|
|
42
|
-
- Add support for 1.23
|
|
51
|
+
- Add support for Scrcpy server version 1.23
|
|
43
52
|
|
|
44
53
|
## 0.0.12
|
|
45
54
|
Sun, 03 Apr 2022 11:18:47 GMT
|
|
@@ -51,7 +60,7 @@ Sun, 03 Apr 2022 10:54:15 GMT
|
|
|
51
60
|
|
|
52
61
|
### Updates
|
|
53
62
|
|
|
54
|
-
- Add support for 1.22
|
|
63
|
+
- Add support for Scrcpy server version 1.22
|
|
55
64
|
- Update to use Web Streams API
|
|
56
65
|
- Improve compatibility with Node.js 12 ESM format
|
|
57
66
|
- Workaround a issue with server crash on Samsung ROM (https://github.com/Genymobile/scrcpy/issues/2841)
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ It's compatible with the official Scrcpy server binaries.
|
|
|
6
6
|
|
|
7
7
|
**WARNING:** The public API is UNSTABLE. If you have any questions, please open an issue.
|
|
8
8
|
|
|
9
|
-
- [
|
|
9
|
+
- [Basic information](#basic-information)
|
|
10
10
|
- [Prepare server binary](#prepare-server-binary)
|
|
11
11
|
- [`fetch-scrcpy-server`](#fetch-scrcpy-server)
|
|
12
12
|
- [Use the server binary](#use-the-server-binary)
|
|
@@ -15,7 +15,7 @@ It's compatible with the official Scrcpy server binaries.
|
|
|
15
15
|
- [Webpack 4](#webpack-4)
|
|
16
16
|
- [Webpack 5](#webpack-5)
|
|
17
17
|
- [Read the server version](#read-the-server-version)
|
|
18
|
-
- [
|
|
18
|
+
- [Server versions](#server-versions)
|
|
19
19
|
- [Use with `@yume-chan/adb`](#use-with-yume-chanadb)
|
|
20
20
|
- [Push server binary](#push-server-binary)
|
|
21
21
|
- [Start server on device](#start-server-on-device)
|
|
@@ -23,17 +23,25 @@ It's compatible with the official Scrcpy server binaries.
|
|
|
23
23
|
- [Parsing video packets](#parsing-video-packets)
|
|
24
24
|
- [Sending control messages](#sending-control-messages)
|
|
25
25
|
- [Reading device messages](#reading-device-messages)
|
|
26
|
-
- [
|
|
26
|
+
- [Always read the streams](#always-read-the-streams)
|
|
27
27
|
- [Video stream](#video-stream)
|
|
28
28
|
- [Decode video stream](#decode-video-stream)
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Basic information
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Although Scrcpy doesn't install any App on the device, it does have a server binary executable to be run on the device.
|
|
33
|
+
|
|
34
|
+
With the official Scrcpy client and server, the client uses ADB to transfer the server binary file to the device, run it, and communicate with it via ADB tunnel (the bootstrap process).
|
|
35
|
+
|
|
36
|
+
This package provides types that can serialize and deserialize Scrcpy protocol messages, but it generally requires you to do the bootstrapping and provide the data stream to the server.
|
|
37
|
+
|
|
38
|
+
If you are also using `@yume-chan/adb`, this package has a helper class that can complete the bootstrap process using it, doing what the official client does.
|
|
39
|
+
|
|
40
|
+
**NOTE:** `@yume-chan/adb` is a peer dependency, you need to install it yourself. Only those types whose names begin with `Adb` requires `@yume-chan/adb`.
|
|
33
41
|
|
|
34
42
|
## Prepare server binary
|
|
35
43
|
|
|
36
|
-
|
|
44
|
+
This package doesn't include the server binary. It's compatible with many versions of the official server binary, but may not work with future versions due to protocol changes.
|
|
37
45
|
|
|
38
46
|
You can download the server binary from official releases (https://github.com/Genymobile/scrcpy/releases), or use the built-in `fetch-scrcpy-server` script to automate the process.
|
|
39
47
|
|
|
@@ -41,9 +49,11 @@ The server binary is subject to [Apache License 2.0](https://github.com/Genymobi
|
|
|
41
49
|
|
|
42
50
|
### `fetch-scrcpy-server`
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
This package includes a script that downloads the server binary from official releases for you.
|
|
45
53
|
|
|
46
|
-
|
|
54
|
+
The `gh-release-fetch@3` package is a peer dependency for this script, thus requires separated installation.
|
|
55
|
+
|
|
56
|
+
Usage:
|
|
47
57
|
|
|
48
58
|
```
|
|
49
59
|
$ npx fetch-scrcpy-server <version>
|
|
@@ -52,14 +62,14 @@ $ npx fetch-scrcpy-server <version>
|
|
|
52
62
|
For example:
|
|
53
63
|
|
|
54
64
|
```
|
|
55
|
-
$ npx fetch-scrcpy-server 1.
|
|
65
|
+
$ npx fetch-scrcpy-server 1.25
|
|
56
66
|
```
|
|
57
67
|
|
|
58
|
-
|
|
68
|
+
It can also be added to the `postinstall` script in `package.json`, so running `npm install` will automatically invoke the script:
|
|
59
69
|
|
|
60
70
|
```json
|
|
61
71
|
"scripts": {
|
|
62
|
-
"postinstall": "fetch-scrcpy-server 1.
|
|
72
|
+
"postinstall": "fetch-scrcpy-server 1.25",
|
|
63
73
|
},
|
|
64
74
|
```
|
|
65
75
|
|
|
@@ -67,7 +77,7 @@ The server binary will be named `bin/scrcpy-server` in this package's installati
|
|
|
67
77
|
|
|
68
78
|
### Use the server binary
|
|
69
79
|
|
|
70
|
-
The server binary file needs to be embedded into your application, the exact method depends on the runtime.
|
|
80
|
+
The server binary file needs to be embedded into your application, the exact method depends on the bundler and runtime.
|
|
71
81
|
|
|
72
82
|
To name a few:
|
|
73
83
|
|
|
@@ -122,12 +132,12 @@ The correct version number is required to launch the server, so `fetch-scrcpy-se
|
|
|
122
132
|
```js
|
|
123
133
|
import SCRCPY_SERVER_VERSION from '@yume-chan/scrcpy/bin/version.js';
|
|
124
134
|
|
|
125
|
-
console.log(SCRCPY_SERVER_VERSION); // "1.
|
|
135
|
+
console.log(SCRCPY_SERVER_VERSION); // "1.25"
|
|
126
136
|
```
|
|
127
137
|
|
|
128
|
-
##
|
|
138
|
+
## Server versions
|
|
129
139
|
|
|
130
|
-
Scrcpy
|
|
140
|
+
Scrcpy protocol change over time, and are usually not backwards compatible. This package supports multiple server versions (or ranges), and uses different option types to choose different behaviors. Using incorrect option version usually results in errors.
|
|
131
141
|
|
|
132
142
|
The latest one may continue to work for future server versions, but there is no guarantee.
|
|
133
143
|
|
|
@@ -139,17 +149,18 @@ The latest one may continue to work for future server versions, but there is no
|
|
|
139
149
|
| 1.22 | `ScrcpyOptions1_22` |
|
|
140
150
|
| 1.23 | `ScrcpyOptions1_23` |
|
|
141
151
|
| 1.24 | `ScrcpyOptions1_24` |
|
|
152
|
+
| 1.25 | `ScrcpyOptions1_25` |
|
|
142
153
|
|
|
143
|
-
When using `AdbScrcpyClient`, there
|
|
154
|
+
When using `AdbScrcpyClient`, there are `AdbScrcpyOptions` containing `@yume-chan/adb` specific options:
|
|
144
155
|
|
|
145
156
|
| Version | Type |
|
|
146
157
|
| --------- | ---------------------- |
|
|
147
158
|
| 1.16~1.21 | `AdbScrcpyOptions1_16` |
|
|
148
|
-
| 1.22~1.
|
|
159
|
+
| 1.22~1.25 | `AdbScrcpyOptions1_22` |
|
|
149
160
|
|
|
150
161
|
## Use with `@yume-chan/adb`
|
|
151
162
|
|
|
152
|
-
|
|
163
|
+
`@yume-chan/adb` is a TypeScript ADB implementation that can run on Web browser. It can be used to bootstrap the server on a device.
|
|
153
164
|
|
|
154
165
|
### Push server binary
|
|
155
166
|
|
|
@@ -193,7 +204,7 @@ import SCRCPY_SERVER_VERSION from '@yume-chan/scrcpy/bin/version.js';
|
|
|
193
204
|
const client: AdbScrcpyClient = await AdbScrcpyClient.start(
|
|
194
205
|
adb,
|
|
195
206
|
DEFAULT_SERVER_PATH,
|
|
196
|
-
SCRCPY_SERVER_VERSION, //
|
|
207
|
+
SCRCPY_SERVER_VERSION, // If server binary was downloaded manually, must provide the correct version
|
|
197
208
|
new AdbScrcpyOptions1_22(ScrcpyOptions1_24({
|
|
198
209
|
// options
|
|
199
210
|
}))
|
|
@@ -216,6 +227,8 @@ If you push, start and connect to the server yourself, you can still use this pa
|
|
|
216
227
|
|
|
217
228
|
Requires a `ReadableStream<Uint8Array>` that reads from the video socket, preserving packet boundaries.
|
|
218
229
|
|
|
230
|
+
**NOTE:** Because this package uses `web-streams-polyfill` NPM package's Web Streams API implementation, the provided `ReadableStream` must also be from `web-streams-polyfill` (or another polyfill that doesn't check object prototype when piping).
|
|
231
|
+
|
|
219
232
|
```ts
|
|
220
233
|
import { ScrcpyOptions1_24, ScrcpyVideoStreamPacket } from '@yume-chan/scrcpy';
|
|
221
234
|
|
|
@@ -253,6 +266,8 @@ controlMessageSerializer.injectText("Hello World!");
|
|
|
253
266
|
|
|
254
267
|
Requires a `ReadableStream<Uint8Array>` that reads from the control socket.
|
|
255
268
|
|
|
269
|
+
**NOTE:** Because this package uses `web-streams-polyfill` NPM package's Web Streams API implementation, the provided `ReadableStream` must also be from `web-streams-polyfill` (or another polyfill that doesn't check object prototype when piping).
|
|
270
|
+
|
|
256
271
|
```ts
|
|
257
272
|
import { ScrcpyDeviceMessageDeserializeStream, ScrcpyOptions1_24 } from '@yume-chan/scrcpy';
|
|
258
273
|
|
|
@@ -261,9 +276,11 @@ const controlStream: ReadableWritablePair<Uint8Array, Uint8Array> | undefined //
|
|
|
261
276
|
const deviceMessageStream: ReadableStream<ScrcpyDeviceMessage> = controlStream.readable.pipeThrough(new ScrcpyDeviceMessageDeserializeStream());
|
|
262
277
|
```
|
|
263
278
|
|
|
264
|
-
##
|
|
279
|
+
## Always read the streams
|
|
280
|
+
|
|
281
|
+
In Web Streams API, `ReadableStream` will block its upstream when too many chunks are kept not read. If multiple streams are from the same upstream source, block one stream means blocking all of them.
|
|
265
282
|
|
|
266
|
-
|
|
283
|
+
For Scrcpy, usually all streams are originated from the same ADB connection (either USB or TCP), so it's important to always read from all streams, even if you don't care about their data.
|
|
267
284
|
|
|
268
285
|
```ts
|
|
269
286
|
// when using `AdbScrcpyClient`
|
|
@@ -271,7 +288,7 @@ stdout
|
|
|
271
288
|
.pipeTo(
|
|
272
289
|
new WritableStream<string>({
|
|
273
290
|
write: (line) => {
|
|
274
|
-
// Handle the stdout line
|
|
291
|
+
// Handle or ignore the stdout line
|
|
275
292
|
},
|
|
276
293
|
}),
|
|
277
294
|
)
|
|
@@ -283,7 +300,7 @@ stdout
|
|
|
283
300
|
videoPacketStream
|
|
284
301
|
.pipeTo(new WritableStream<ScrcpyVideoStreamPacket>({
|
|
285
302
|
write: (packet) => {
|
|
286
|
-
// Handle the video packet
|
|
303
|
+
// Handle or ignore the video packet
|
|
287
304
|
},
|
|
288
305
|
}))
|
|
289
306
|
.catch(() => {});
|
|
@@ -291,7 +308,7 @@ videoPacketStream
|
|
|
291
308
|
deviceMessageStream
|
|
292
309
|
.pipeTo(new WritableStream<ScrcpyDeviceMessage>({
|
|
293
310
|
write: (message) => {
|
|
294
|
-
// Handle the device message
|
|
311
|
+
// Handle or ignore the device message
|
|
295
312
|
},
|
|
296
313
|
}))
|
|
297
314
|
.catch(() => {});
|
package/bin/scrcpy-server
CHANGED
|
Binary file
|
package/bin/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.
|
|
1
|
+
export default '1.25';
|
package/bin/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.
|
|
1
|
+
export default '1.25';
|
package/esm/adb/client.d.ts
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { Adb, AdbSubprocessProtocol } from
|
|
2
|
-
import { ReadableStream, WrapWritableStream, type ReadableWritablePair } from
|
|
3
|
-
import { ScrcpyControlMessageSerializer } from
|
|
4
|
-
import { type
|
|
5
|
-
import type
|
|
1
|
+
import { type Adb, type AdbSubprocessProtocol } from "@yume-chan/adb";
|
|
2
|
+
import { ReadableStream, WrapWritableStream, type ReadableWritablePair } from "@yume-chan/stream-extra";
|
|
3
|
+
import { ScrcpyControlMessageSerializer } from "../control/index.js";
|
|
4
|
+
import { type ScrcpyDeviceMessage } from "../device-message/index.js";
|
|
5
|
+
import { type ScrcpyVideoStreamPacket } from "../options/index.js";
|
|
6
|
+
import { type AdbScrcpyOptions } from "./options/index.js";
|
|
7
|
+
export declare class ScrcpyExitedError extends Error {
|
|
8
|
+
output: string[];
|
|
9
|
+
constructor(output: string[]);
|
|
10
|
+
}
|
|
6
11
|
export declare class AdbScrcpyClient {
|
|
7
12
|
static pushServer(adb: Adb, path?: string): WrapWritableStream<Uint8Array>;
|
|
8
|
-
static start(adb: Adb, path: string, version: string, options: AdbScrcpyOptions<
|
|
13
|
+
static start(adb: Adb, path: string, version: string, options: AdbScrcpyOptions<object>): Promise<AdbScrcpyClient>;
|
|
9
14
|
/**
|
|
10
15
|
* This method will modify the given `options`,
|
|
11
16
|
* so don't reuse it elsewhere.
|
|
12
17
|
*/
|
|
13
|
-
static getEncoders(adb: Adb, path: string, version: string, options: AdbScrcpyOptions<
|
|
18
|
+
static getEncoders(adb: Adb, path: string, version: string, options: AdbScrcpyOptions<object>): Promise<string[]>;
|
|
14
19
|
/**
|
|
15
20
|
* This method will modify the given `options`,
|
|
16
21
|
* so don't reuse it elsewhere.
|
|
17
22
|
*/
|
|
18
|
-
static getDisplays(adb: Adb, path: string, version: string, options: AdbScrcpyOptions<
|
|
23
|
+
static getDisplays(adb: Adb, path: string, version: string, options: AdbScrcpyOptions<object>): Promise<number[]>;
|
|
19
24
|
private process;
|
|
20
25
|
private _stdout;
|
|
21
26
|
get stdout(): ReadableStream<string>;
|
|
@@ -29,12 +34,8 @@ export declare class AdbScrcpyClient {
|
|
|
29
34
|
private _controlMessageSerializer;
|
|
30
35
|
get controlMessageSerializer(): ScrcpyControlMessageSerializer | undefined;
|
|
31
36
|
private _deviceMessageStream;
|
|
32
|
-
get deviceMessageStream(): ReadableStream<
|
|
33
|
-
|
|
34
|
-
length: number;
|
|
35
|
-
content: string;
|
|
36
|
-
}> | undefined;
|
|
37
|
-
constructor(options: AdbScrcpyOptions<any>, process: AdbSubprocessProtocol, stdout: ReadableStream<string>, videoStream: ReadableStream<Uint8Array>, controlStream: ReadableWritablePair<Uint8Array, Uint8Array> | undefined);
|
|
37
|
+
get deviceMessageStream(): ReadableStream<ScrcpyDeviceMessage> | undefined;
|
|
38
|
+
constructor(options: AdbScrcpyOptions<object>, process: AdbSubprocessProtocol, stdout: ReadableStream<string>, videoStream: ReadableStream<Uint8Array>, controlStream: ReadableWritablePair<Uint8Array, Uint8Array> | undefined);
|
|
38
39
|
close(): Promise<void>;
|
|
39
40
|
}
|
|
40
41
|
//# sourceMappingURL=client.d.ts.map
|
package/esm/adb/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/adb/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/adb/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,GAAG,EACR,KAAK,qBAAqB,EAE7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIH,cAAc,EAEd,kBAAkB,EAIlB,KAAK,oBAAoB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAEH,KAAK,mBAAmB,EAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEH,KAAK,uBAAuB,EA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qB,EAC9B,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,EAC9B,WAAW,EAAE,cAAc,CAAC,UAAU,CAAC,EACvC,aAAa,EAAE,oBAAoB,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,SAAS;IA2B9D,KAAK;CAGrB"}
|
package/esm/adb/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AdbSubprocessNoneProtocol } from
|
|
2
|
-
import { AbortController, DecodeUtf8Stream, InspectStream, ReadableStream, SplitStringStream, WrapWritableStream, WritableStream } from
|
|
3
|
-
import { ScrcpyControlMessageSerializer } from
|
|
4
|
-
import { ScrcpyDeviceMessageDeserializeStream } from
|
|
5
|
-
import { DEFAULT_SERVER_PATH } from
|
|
1
|
+
import { AdbSubprocessNoneProtocol, } from "@yume-chan/adb";
|
|
2
|
+
import { AbortController, DecodeUtf8Stream, InspectStream, ReadableStream, SplitStringStream, WrapWritableStream, WritableStream, } from "@yume-chan/stream-extra";
|
|
3
|
+
import { ScrcpyControlMessageSerializer } from "../control/index.js";
|
|
4
|
+
import { ScrcpyDeviceMessageDeserializeStream, } from "../device-message/index.js";
|
|
5
|
+
import { DEFAULT_SERVER_PATH, } from "../options/index.js";
|
|
6
6
|
class ArrayToStream extends ReadableStream {
|
|
7
7
|
array;
|
|
8
8
|
index = 0;
|
|
@@ -42,7 +42,7 @@ class ConcatStream extends ReadableStream {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
this.advance(controller);
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
advance(controller) {
|
|
@@ -55,6 +55,13 @@ class ConcatStream extends ReadableStream {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
export class ScrcpyExitedError extends Error {
|
|
59
|
+
output;
|
|
60
|
+
constructor(output) {
|
|
61
|
+
super("scrcpy server exited prematurely");
|
|
62
|
+
this.output = output;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
58
65
|
export class AdbScrcpyClient {
|
|
59
66
|
static pushServer(adb, path = DEFAULT_SERVER_PATH) {
|
|
60
67
|
let sync;
|
|
@@ -76,9 +83,9 @@ export class AdbScrcpyClient {
|
|
|
76
83
|
process = await adb.subprocess.spawn([
|
|
77
84
|
// cspell: disable-next-line
|
|
78
85
|
`CLASSPATH=${path}`,
|
|
79
|
-
|
|
80
|
-
/* unused */
|
|
81
|
-
|
|
86
|
+
"app_process",
|
|
87
|
+
/* unused */ "/",
|
|
88
|
+
"com.genymobile.scrcpy.Server",
|
|
82
89
|
version,
|
|
83
90
|
...options.formatServerArguments(),
|
|
84
91
|
], {
|
|
@@ -88,7 +95,7 @@ export class AdbScrcpyClient {
|
|
|
88
95
|
});
|
|
89
96
|
const stdout = process.stdout
|
|
90
97
|
.pipeThrough(new DecodeUtf8Stream())
|
|
91
|
-
.pipeThrough(new SplitStringStream(
|
|
98
|
+
.pipeThrough(new SplitStringStream("\n"));
|
|
92
99
|
// Read stdout, otherwise `process.exit` won't resolve.
|
|
93
100
|
const output = [];
|
|
94
101
|
const abortController = new AbortController();
|
|
@@ -96,20 +103,20 @@ export class AdbScrcpyClient {
|
|
|
96
103
|
.pipeTo(new WritableStream({
|
|
97
104
|
write(chunk) {
|
|
98
105
|
output.push(chunk);
|
|
99
|
-
}
|
|
106
|
+
},
|
|
100
107
|
}), {
|
|
101
108
|
signal: abortController.signal,
|
|
102
109
|
preventCancel: true,
|
|
103
110
|
})
|
|
104
|
-
.catch(() => {
|
|
111
|
+
.catch((e) => {
|
|
112
|
+
void e;
|
|
113
|
+
});
|
|
105
114
|
const result = await Promise.race([
|
|
106
115
|
process.exit,
|
|
107
116
|
connection.getStreams(),
|
|
108
117
|
]);
|
|
109
|
-
if (typeof result ===
|
|
110
|
-
|
|
111
|
-
error.output = output;
|
|
112
|
-
throw error;
|
|
118
|
+
if (typeof result === "number") {
|
|
119
|
+
throw new ScrcpyExitedError(output);
|
|
113
120
|
}
|
|
114
121
|
abortController.abort();
|
|
115
122
|
await pipe;
|
|
@@ -129,13 +136,15 @@ export class AdbScrcpyClient {
|
|
|
129
136
|
* so don't reuse it elsewhere.
|
|
130
137
|
*/
|
|
131
138
|
static async getEncoders(adb, path, version, options) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
Object.assign(options.value, {
|
|
140
|
+
// Provide an invalid encoder name
|
|
141
|
+
// So the server will return all available encoders
|
|
142
|
+
encoderName: "_",
|
|
143
|
+
// Disable control for faster connection in 1.22+
|
|
144
|
+
control: false,
|
|
145
|
+
sendDeviceMeta: false,
|
|
146
|
+
sendDummyByte: false,
|
|
147
|
+
});
|
|
139
148
|
// Scrcpy server will open connections, before initializing encoder
|
|
140
149
|
// Thus although an invalid encoder name is given, the start process will success
|
|
141
150
|
const client = await AdbScrcpyClient.start(adb, path, version, options);
|
|
@@ -156,21 +165,23 @@ export class AdbScrcpyClient {
|
|
|
156
165
|
* so don't reuse it elsewhere.
|
|
157
166
|
*/
|
|
158
167
|
static async getDisplays(adb, path, version, options) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
Object.assign(options.value, {
|
|
169
|
+
// Similar to `getEncoders`, pass an invalid option and parse the output
|
|
170
|
+
displayId: -1,
|
|
171
|
+
// Disable control for faster connection in 1.22+
|
|
172
|
+
control: false,
|
|
173
|
+
sendDeviceMeta: false,
|
|
174
|
+
sendDummyByte: false,
|
|
175
|
+
});
|
|
164
176
|
try {
|
|
165
177
|
// Server will exit before opening connections when an invalid display id was given.
|
|
166
178
|
await AdbScrcpyClient.start(adb, path, version, options);
|
|
167
179
|
}
|
|
168
180
|
catch (e) {
|
|
169
|
-
if (e instanceof
|
|
170
|
-
const output = e.output;
|
|
181
|
+
if (e instanceof ScrcpyExitedError) {
|
|
171
182
|
const displayIdRegex = /\s+scrcpy --display (\d+)/;
|
|
172
183
|
const displays = [];
|
|
173
|
-
for (const line of output) {
|
|
184
|
+
for (const line of e.output) {
|
|
174
185
|
const match = line.match(displayIdRegex);
|
|
175
186
|
if (match) {
|
|
176
187
|
displays.push(Number.parseInt(match[1], 10));
|
|
@@ -179,29 +190,43 @@ export class AdbScrcpyClient {
|
|
|
179
190
|
return displays;
|
|
180
191
|
}
|
|
181
192
|
}
|
|
182
|
-
throw new Error(
|
|
193
|
+
throw new Error("failed to get displays");
|
|
183
194
|
}
|
|
184
195
|
process;
|
|
185
196
|
_stdout;
|
|
186
|
-
get stdout() {
|
|
187
|
-
|
|
197
|
+
get stdout() {
|
|
198
|
+
return this._stdout;
|
|
199
|
+
}
|
|
200
|
+
get exit() {
|
|
201
|
+
return this.process.exit;
|
|
202
|
+
}
|
|
188
203
|
_screenWidth;
|
|
189
|
-
get screenWidth() {
|
|
204
|
+
get screenWidth() {
|
|
205
|
+
return this._screenWidth;
|
|
206
|
+
}
|
|
190
207
|
_screenHeight;
|
|
191
|
-
get screenHeight() {
|
|
208
|
+
get screenHeight() {
|
|
209
|
+
return this._screenHeight;
|
|
210
|
+
}
|
|
192
211
|
_videoStream;
|
|
193
|
-
get videoStream() {
|
|
212
|
+
get videoStream() {
|
|
213
|
+
return this._videoStream;
|
|
214
|
+
}
|
|
194
215
|
_controlMessageSerializer;
|
|
195
|
-
get controlMessageSerializer() {
|
|
216
|
+
get controlMessageSerializer() {
|
|
217
|
+
return this._controlMessageSerializer;
|
|
218
|
+
}
|
|
196
219
|
_deviceMessageStream;
|
|
197
|
-
get deviceMessageStream() {
|
|
220
|
+
get deviceMessageStream() {
|
|
221
|
+
return this._deviceMessageStream;
|
|
222
|
+
}
|
|
198
223
|
constructor(options, process, stdout, videoStream, controlStream) {
|
|
199
224
|
this.process = process;
|
|
200
225
|
this._stdout = stdout;
|
|
201
226
|
this._videoStream = videoStream
|
|
202
227
|
.pipeThrough(options.createVideoStreamTransformer())
|
|
203
|
-
.pipeThrough(new InspectStream(packet => {
|
|
204
|
-
if (packet.type ===
|
|
228
|
+
.pipeThrough(new InspectStream((packet) => {
|
|
229
|
+
if (packet.type === "configuration") {
|
|
205
230
|
this._screenWidth = packet.data.croppedWidth;
|
|
206
231
|
this._screenHeight = packet.data.croppedHeight;
|
|
207
232
|
}
|
package/esm/adb/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/adb/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/adb/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,GAI5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GAIjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACH,oCAAoC,GAEvC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,mBAAmB,GAEtB,MAAM,qBAAqB,CAAC;AAI7B,MAAM,aAAiB,SAAQ,cAAiB;IACpC,KAAK,CAAO;IACZ,KAAK,GAAG,CAAC,CAAC;IAElB,YAAY,KAAU;QAClB,KAAK,CAAC;YACF,KAAK,EAAE,KAAK,IAAI,EAAE;gBACd,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;gBACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACvB,CAAC;YACD,IAAI,EAAE,CAAC,UAAU,EAAE,EAAE;gBACjB,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;oBAChC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC,CAAC;oBAC5C,IAAI,CAAC,KAAK,IAAI,CAA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WAAW,CACR,IAAI,aAAa,CAAC,CAAC,MAAM,EAAE,EAAE;YACzB,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,EAAE;gBACjC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;gBAC7C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;aAClD;QACL,CAAC,CAAC,CACL,CAAC;QAEN,IAAI,aAAa,EAAE;YACf,IAAI,CAAC,yBAAyB,GAAG,IAAI,8BAA8B,CAC/D,aAAa,CAAC,QAAQ,EACtB,OAAO,CACV,CAAC;YACF,IAAI,CAAC,oBAAoB,GAAG,aAAa,CAAC,QAAQ,CAAC,WAAW,CAC1D,IAAI,oCAAoC,EAAE,CAC7C,CAAC;SACL;IACL,CAAC;IAEM,KAAK,CAAC,KAAK;QACd,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;CACJ"}
|
package/esm/adb/connection.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
import { type ReadableStream, type ReadableWritablePair } from
|
|
4
|
-
import type
|
|
1
|
+
import { type Adb } from "@yume-chan/adb";
|
|
2
|
+
import { type Disposable } from "@yume-chan/event";
|
|
3
|
+
import { type ReadableStream, type ReadableWritablePair } from "@yume-chan/stream-extra";
|
|
4
|
+
import { type ValueOrPromise } from "@yume-chan/struct";
|
|
5
5
|
export interface AdbScrcpyConnectionOptions {
|
|
6
6
|
control: boolean;
|
|
7
7
|
/**
|
|
@@ -18,21 +18,30 @@ export declare abstract class AdbScrcpyConnection implements Disposable {
|
|
|
18
18
|
protected options: AdbScrcpyConnectionOptions;
|
|
19
19
|
constructor(adb: Adb, options: AdbScrcpyConnectionOptions);
|
|
20
20
|
initialize(): ValueOrPromise<void>;
|
|
21
|
-
abstract getStreams(): ValueOrPromise<[
|
|
21
|
+
abstract getStreams(): ValueOrPromise<[
|
|
22
|
+
videoSteam: ReadableStream<Uint8Array>,
|
|
23
|
+
controlStream: ReadableWritablePair<Uint8Array, Uint8Array> | undefined
|
|
24
|
+
]>;
|
|
22
25
|
dispose(): void;
|
|
23
26
|
}
|
|
24
27
|
export declare class AdbScrcpyForwardConnection extends AdbScrcpyConnection {
|
|
25
28
|
private connect;
|
|
26
29
|
private connectAndRetry;
|
|
27
30
|
private connectVideoStream;
|
|
28
|
-
getStreams(): Promise<[
|
|
31
|
+
getStreams(): Promise<[
|
|
32
|
+
videoSteam: ReadableStream<Uint8Array>,
|
|
33
|
+
controlStream: ReadableWritablePair<Uint8Array, Uint8Array> | undefined
|
|
34
|
+
]>;
|
|
29
35
|
}
|
|
30
36
|
export declare class AdbScrcpyReverseConnection extends AdbScrcpyConnection {
|
|
31
37
|
private streams;
|
|
32
38
|
private address;
|
|
33
39
|
initialize(): Promise<void>;
|
|
34
40
|
private accept;
|
|
35
|
-
getStreams(): Promise<[
|
|
41
|
+
getStreams(): Promise<[
|
|
42
|
+
videoSteam: ReadableStream<Uint8Array>,
|
|
43
|
+
controlStream: ReadableWritablePair<Uint8Array, Uint8Array> | undefined
|
|
44
|
+
]>;
|
|
36
45
|
dispose(): void;
|
|
37
46
|
}
|
|
38
47
|
//# sourceMappingURL=connection.d.ts.map
|