@yume-chan/scrcpy 0.0.18 → 0.0.19
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 +18 -0
- package/CHANGELOG.md +10 -1
- package/README.md +111 -61
- 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 +40 -40
- package/esm/adb/client.d.ts.map +1 -1
- package/esm/adb/client.js +223 -242
- package/esm/adb/client.js.map +1 -1
- package/esm/adb/connection.d.ts +48 -46
- package/esm/adb/connection.d.ts.map +1 -1
- package/esm/adb/connection.js +121 -109
- package/esm/adb/connection.js.map +1 -1
- package/esm/adb/index.d.ts +3 -3
- package/esm/adb/index.js +3 -3
- package/esm/adb/options/1_16.d.ts +7 -7
- package/esm/adb/options/1_16.d.ts.map +1 -1
- package/esm/adb/options/1_16.js +19 -19
- package/esm/adb/options/1_16.js.map +1 -1
- package/esm/adb/options/1_22.d.ts +7 -7
- package/esm/adb/options/1_22.d.ts.map +1 -1
- package/esm/adb/options/1_22.js +16 -16
- package/esm/adb/options/1_22.js.map +1 -1
- package/esm/adb/options/1_26.d.ts +9 -0
- package/esm/adb/options/1_26.d.ts.map +1 -0
- package/esm/adb/options/1_26.js +11 -0
- package/esm/adb/options/1_26.js.map +1 -0
- package/esm/adb/options/2_0.d.ts +8 -0
- package/esm/adb/options/2_0.d.ts.map +1 -0
- package/esm/adb/options/2_0.js +13 -0
- package/esm/adb/options/2_0.js.map +1 -0
- package/esm/adb/options/index.d.ts +3 -3
- package/esm/adb/options/index.js +3 -3
- package/esm/adb/options/types.d.ts +23 -23
- package/esm/adb/options/types.d.ts.map +1 -1
- package/esm/adb/options/types.js +36 -36
- package/esm/codec/av1.d.ts +33 -0
- package/esm/codec/av1.d.ts.map +1 -0
- package/esm/codec/av1.js +35 -0
- package/esm/codec/av1.js.map +1 -0
- package/esm/codec/h264.d.ts +98 -0
- package/esm/codec/h264.d.ts.map +1 -0
- package/esm/codec/h264.js +477 -0
- package/esm/codec/h264.js.map +1 -0
- package/esm/codec/h265.d.ts +36 -0
- package/esm/codec/h265.d.ts.map +1 -0
- package/esm/codec/h265.js +38 -0
- package/esm/codec/h265.js.map +1 -0
- package/esm/codec/index.d.ts +4 -0
- package/esm/codec/index.d.ts.map +1 -0
- package/esm/codec/index.js +4 -0
- package/esm/codec/index.js.map +1 -0
- package/esm/codec.d.ts +33 -33
- package/esm/codec.js +36 -36
- package/esm/control/back-or-screen-on.d.ts +2 -2
- package/esm/control/back-or-screen-on.d.ts.map +1 -1
- package/esm/control/back-or-screen-on.js +1 -1
- package/esm/control/basic.d.ts +5 -0
- package/esm/control/basic.d.ts.map +1 -0
- package/esm/control/basic.js +3 -0
- package/esm/control/basic.js.map +1 -0
- package/esm/control/hover-helper.d.ts +17 -17
- package/esm/control/hover-helper.d.ts.map +1 -1
- package/esm/control/hover-helper.js +43 -43
- package/esm/control/hover-helper.js.map +1 -1
- package/esm/control/index.d.ts +11 -11
- package/esm/control/index.js +11 -11
- package/esm/control/inject-keycode.d.ts +194 -60
- package/esm/control/inject-keycode.d.ts.map +1 -1
- package/esm/control/inject-keycode.js +199 -61
- package/esm/control/inject-keycode.js.map +1 -1
- package/esm/control/inject-scroll.d.ts +2 -2
- package/esm/control/inject-scroll.d.ts.map +1 -1
- package/esm/control/inject-scroll.js +1 -1
- package/esm/control/inject-text.d.ts +8 -8
- package/esm/control/inject-text.d.ts.map +1 -1
- package/esm/control/inject-text.js +6 -6
- package/esm/control/inject-text.js.map +1 -1
- package/esm/control/inject-touch.d.ts +37 -37
- package/esm/control/inject-touch.d.ts.map +1 -1
- package/esm/control/inject-touch.js +62 -62
- package/esm/control/rotate-device.d.ts +6 -6
- package/esm/control/rotate-device.d.ts.map +1 -1
- package/esm/control/rotate-device.js +3 -4
- package/esm/control/rotate-device.js.map +1 -1
- package/esm/control/serializer.d.ts +35 -33
- package/esm/control/serializer.d.ts.map +1 -1
- package/esm/control/serializer.js +82 -78
- package/esm/control/serializer.js.map +1 -1
- package/esm/control/set-clipboard.d.ts +2 -2
- package/esm/control/set-clipboard.d.ts.map +1 -1
- package/esm/control/set-clipboard.js +1 -1
- package/esm/control/set-screen-power-mode.d.ts +11 -11
- package/esm/control/set-screen-power-mode.d.ts.map +1 -1
- package/esm/control/set-screen-power-mode.js +11 -11
- package/esm/control/set-screen-power-mode.js.map +1 -1
- package/esm/control/simple.d.ts +5 -0
- package/esm/control/simple.d.ts.map +1 -0
- package/esm/control/simple.js +3 -0
- package/esm/control/simple.js.map +1 -0
- package/esm/control/type.d.ts +14 -14
- package/esm/control/type.js +18 -18
- package/esm/decoder.d.ts +2 -0
- package/esm/decoder.d.ts.map +1 -0
- package/esm/decoder.js +2 -0
- package/esm/decoder.js.map +1 -0
- package/esm/device-message/ack-clipboard.d.ts +8 -8
- package/esm/device-message/ack-clipboard.d.ts.map +1 -1
- package/esm/device-message/ack-clipboard.js +5 -5
- package/esm/device-message/clipboard.d.ts +9 -9
- package/esm/device-message/clipboard.d.ts.map +1 -1
- package/esm/device-message/clipboard.js +6 -6
- package/esm/device-message/index.d.ts +4 -4
- package/esm/device-message/index.js +4 -4
- package/esm/device-message/stream.d.ts +7 -7
- package/esm/device-message/stream.js +19 -19
- package/esm/device-message/type.d.ts +4 -4
- package/esm/device-message/type.js +6 -6
- package/esm/index.d.ts +5 -5
- package/esm/index.js +5 -5
- package/esm/options/1.17.d.ts +3 -0
- package/esm/options/1.17.d.ts.map +1 -0
- package/esm/options/1.17.js +2 -0
- package/esm/options/1.17.js.map +1 -0
- package/esm/options/1_16/codec-options.d.ts +20 -19
- package/esm/options/1_16/codec-options.d.ts.map +1 -1
- package/esm/options/1_16/codec-options.js +25 -25
- package/esm/options/1_16/codec-options.js.map +1 -1
- package/esm/options/1_16/float-to-uint16.d.ts +5 -0
- package/esm/options/1_16/float-to-uint16.d.ts.map +1 -0
- package/esm/options/1_16/float-to-uint16.js +27 -0
- package/esm/options/1_16/float-to-uint16.js.map +1 -0
- package/esm/options/1_16/h264-configuration.d.ts +48 -48
- package/esm/options/1_16/h264-configuration.js +413 -413
- package/esm/options/1_16/index.d.ts +4 -4
- package/esm/options/1_16/index.js +4 -4
- package/esm/options/1_16/init.d.ts +66 -0
- package/esm/options/1_16/init.d.ts.map +1 -0
- package/esm/options/1_16/init.js +16 -0
- package/esm/options/1_16/init.js.map +1 -0
- package/esm/options/1_16/message.d.ts +32 -0
- package/esm/options/1_16/message.d.ts.map +1 -0
- package/esm/options/1_16/message.js +37 -0
- package/esm/options/1_16/message.js.map +1 -0
- package/esm/options/1_16/options.d.ts +102 -93
- package/esm/options/1_16/options.d.ts.map +1 -1
- package/esm/options/1_16/options.js +189 -189
- package/esm/options/1_16/options.js.map +1 -1
- package/esm/options/1_16/scroll.d.ts +27 -26
- package/esm/options/1_16/scroll.d.ts.map +1 -1
- package/esm/options/1_16/scroll.js +55 -55
- package/esm/options/1_16/scroll.js.map +1 -1
- package/esm/options/1_17.d.ts +32 -0
- package/esm/options/1_17.d.ts.map +1 -0
- package/esm/options/1_17.js +36 -0
- package/esm/options/1_17.js.map +1 -0
- package/esm/options/1_18.d.ts +21 -19
- package/esm/options/1_18.d.ts.map +1 -1
- package/esm/options/1_18.js +45 -45
- package/esm/options/1_18.js.map +1 -1
- package/esm/options/1_21.d.ts +22 -20
- package/esm/options/1_21.d.ts.map +1 -1
- package/esm/options/1_21.js +36 -36
- package/esm/options/1_21.js.map +1 -1
- package/esm/options/1_22/index.d.ts +2 -2
- package/esm/options/1_22/index.js +2 -2
- package/esm/options/1_22/init.d.ts +17 -0
- package/esm/options/1_22/init.d.ts.map +1 -0
- package/esm/options/1_22/init.js +2 -0
- package/esm/options/1_22/init.js.map +1 -0
- package/esm/options/1_22/options.d.ts +29 -28
- package/esm/options/1_22/options.d.ts.map +1 -1
- package/esm/options/1_22/options.js +25 -25
- package/esm/options/1_22/options.js.map +1 -1
- package/esm/options/1_22/scroll.d.ts +16 -16
- package/esm/options/1_22/scroll.d.ts.map +1 -1
- package/esm/options/1_22/scroll.js +14 -14
- package/esm/options/1_23.d.ts +12 -11
- package/esm/options/1_23.d.ts.map +1 -1
- package/esm/options/1_23.js +34 -34
- package/esm/options/1_23.js.map +1 -1
- package/esm/options/1_24.d.ts +9 -8
- package/esm/options/1_24.d.ts.map +1 -1
- package/esm/options/1_24.js +12 -12
- package/esm/options/1_24.js.map +1 -1
- package/esm/options/1_25/index.d.ts +2 -2
- package/esm/options/1_25/index.js +2 -2
- package/esm/options/1_25/options.d.ts +6 -5
- package/esm/options/1_25/options.d.ts.map +1 -1
- package/esm/options/1_25/options.js +7 -7
- package/esm/options/1_25/options.js.map +1 -1
- package/esm/options/1_25/scroll.d.ts +19 -18
- package/esm/options/1_25/scroll.d.ts.map +1 -1
- package/esm/options/1_25/scroll.js +32 -32
- package/esm/options/1_25/scroll.js.map +1 -1
- package/esm/options/1_26.d.ts +57 -0
- package/esm/options/1_26.d.ts.map +1 -0
- package/esm/options/1_26.js +67 -0
- package/esm/options/1_26.js.map +1 -0
- package/esm/options/2.d.ts +57 -0
- package/esm/options/2.d.ts.map +1 -0
- package/esm/options/2.js +67 -0
- package/esm/options/2.js.map +1 -0
- package/esm/options/2_0.d.ts +87 -0
- package/esm/options/2_0.d.ts.map +1 -0
- package/esm/options/2_0.js +175 -0
- package/esm/options/2_0.js.map +1 -0
- package/esm/options/codec.d.ts +52 -0
- package/esm/options/codec.d.ts.map +1 -0
- package/esm/options/codec.js +26 -0
- package/esm/options/codec.js.map +1 -0
- package/esm/options/index.d.ts +8 -8
- package/esm/options/index.js +8 -8
- package/esm/options/latest.d.ts +12 -0
- package/esm/options/latest.d.ts.map +1 -0
- package/esm/options/latest.js +8 -0
- package/esm/options/latest.js.map +1 -0
- package/esm/options/types.d.ts +46 -46
- package/esm/options/types.d.ts.map +1 -1
- package/esm/options/types.js +17 -17
- package/package.json +11 -10
- package/src/adb/client.ts +72 -88
- package/src/adb/connection.ts +42 -25
- package/src/adb/index.ts +3 -3
- package/src/adb/options/1_16.ts +6 -4
- package/src/adb/options/1_22.ts +3 -3
- package/src/adb/options/index.ts +3 -3
- package/src/adb/options/types.ts +10 -10
- package/src/control/back-or-screen-on.ts +1 -1
- package/src/control/hover-helper.ts +2 -4
- package/src/control/inject-keycode.ts +193 -48
- package/src/control/inject-scroll.ts +1 -1
- package/src/control/inject-text.ts +7 -8
- package/src/control/inject-touch.ts +1 -1
- package/src/control/rotate-device.ts +7 -6
- package/src/control/serializer.ts +29 -26
- package/src/control/set-clipboard.ts +1 -1
- package/src/control/set-screen-power-mode.ts +7 -8
- package/src/device-message/ack-clipboard.ts +1 -1
- package/src/device-message/clipboard.ts +1 -1
- package/src/index.ts +5 -5
- package/src/options/1_16/codec-options.ts +4 -6
- package/src/options/1_16/options.ts +17 -12
- package/src/options/1_16/scroll.ts +2 -4
- package/src/options/1_18.ts +6 -6
- package/src/options/1_21.ts +5 -6
- package/src/options/1_22/options.ts +3 -2
- package/src/options/1_22/scroll.ts +1 -1
- package/src/options/1_23.ts +3 -5
- package/src/options/1_24.ts +5 -3
- package/src/options/1_25/options.ts +3 -2
- package/src/options/1_25/scroll.ts +4 -7
- package/src/options/index.ts +3 -3
- package/src/options/types.ts +8 -8
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -7,58 +7,203 @@ export enum AndroidKeyEventAction {
|
|
|
7
7
|
Up = 1,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
// https://
|
|
10
|
+
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/KeyEvent.java;l=993;drc=95c1165bb895dd844e1793460710f7163dd330a3
|
|
11
|
+
export enum AndroidKeyEventMeta {
|
|
12
|
+
AltOn = 0x02,
|
|
13
|
+
AltLeftOn = 0x10,
|
|
14
|
+
AltRightOn = 0x20,
|
|
15
|
+
ShiftOn = 0x01,
|
|
16
|
+
ShiftLeftOn = 0x40,
|
|
17
|
+
ShiftRightOn = 0x80,
|
|
18
|
+
CtrlOn = 0x1000,
|
|
19
|
+
CtrlLeftOn = 0x2000,
|
|
20
|
+
CtrlRightOn = 0x4000,
|
|
21
|
+
MetaOn = 0x10000,
|
|
22
|
+
MetaLeftOn = 0x20000,
|
|
23
|
+
MetaRightOn = 0x40000,
|
|
24
|
+
CapsLockOn = 0x100000,
|
|
25
|
+
NumLockOn = 0x200000,
|
|
26
|
+
ScrollLockOn = 0x400000,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/KeyEvent.java;l=97;drc=95c1165bb895dd844e1793460710f7163dd330a3
|
|
30
|
+
// Most names follow Web API `KeyboardEvent.code`,
|
|
31
|
+
// Android-only (not exist in HID keyboard standard) keys are prefixed by `Android`.
|
|
11
32
|
export enum AndroidKeyCode {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
AndroidHome = 3,
|
|
34
|
+
AndroidBack = 4,
|
|
35
|
+
AndroidCall,
|
|
36
|
+
AndroidEndCall,
|
|
37
|
+
|
|
38
|
+
Digit0,
|
|
39
|
+
Digit1,
|
|
40
|
+
Digit2,
|
|
41
|
+
Digit3,
|
|
42
|
+
Digit4,
|
|
43
|
+
Digit5,
|
|
44
|
+
Digit6,
|
|
45
|
+
Digit7,
|
|
46
|
+
Digit8,
|
|
47
|
+
Digit9,
|
|
48
|
+
/**
|
|
49
|
+
* '*' key.
|
|
50
|
+
*/
|
|
51
|
+
Star, // Name not verified
|
|
52
|
+
/**
|
|
53
|
+
* '#' key.
|
|
54
|
+
*/
|
|
55
|
+
Pound, // Name not verified
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Directional Pad Up key.
|
|
59
|
+
*/
|
|
60
|
+
ArrowUp,
|
|
61
|
+
/**
|
|
62
|
+
* Directional Pad Down key.
|
|
63
|
+
*/
|
|
64
|
+
ArrowDown,
|
|
65
|
+
/**
|
|
66
|
+
* Directional Pad Left key.
|
|
67
|
+
*/
|
|
68
|
+
ArrowLeft,
|
|
69
|
+
/**
|
|
70
|
+
* Directional Pad Right key.
|
|
71
|
+
*/
|
|
72
|
+
ArrowRight,
|
|
73
|
+
/**
|
|
74
|
+
* Directional Pad Center key.
|
|
75
|
+
*/
|
|
76
|
+
AndroidDPadCenter,
|
|
77
|
+
|
|
78
|
+
VolumeUp, // Name not verified
|
|
79
|
+
VolumeDown, // Name not verified
|
|
80
|
+
Power, // Name not verified
|
|
81
|
+
AndroidCamera,
|
|
82
|
+
Clear, // Name not verified
|
|
83
|
+
|
|
84
|
+
KeyA,
|
|
85
|
+
KeyB,
|
|
86
|
+
KeyC,
|
|
87
|
+
KeyD,
|
|
88
|
+
KeyE,
|
|
89
|
+
KeyF,
|
|
90
|
+
KeyG,
|
|
91
|
+
KeyH,
|
|
92
|
+
KeyI,
|
|
93
|
+
KeyJ,
|
|
94
|
+
KeyK,
|
|
95
|
+
KeyL,
|
|
96
|
+
KeyM,
|
|
97
|
+
KeyN,
|
|
98
|
+
KeyO,
|
|
99
|
+
KeyP,
|
|
100
|
+
KeyQ,
|
|
101
|
+
KeyR,
|
|
102
|
+
KeyS,
|
|
103
|
+
KeyT,
|
|
104
|
+
KeyU,
|
|
105
|
+
KeyV,
|
|
106
|
+
KeyW,
|
|
107
|
+
KeyX,
|
|
108
|
+
KeyY,
|
|
109
|
+
KeyZ,
|
|
110
|
+
Comma,
|
|
111
|
+
Period,
|
|
112
|
+
AltLeft,
|
|
113
|
+
AltRight,
|
|
114
|
+
ShiftLeft,
|
|
115
|
+
ShiftRight,
|
|
116
|
+
Tab,
|
|
51
117
|
Space,
|
|
52
|
-
|
|
53
|
-
|
|
118
|
+
AndroidSymbol,
|
|
119
|
+
AndroidExplorer,
|
|
120
|
+
AndroidEnvelope,
|
|
121
|
+
Enter,
|
|
122
|
+
Backspace,
|
|
123
|
+
Backquote,
|
|
124
|
+
Minus,
|
|
125
|
+
Equal,
|
|
126
|
+
BracketLeft,
|
|
127
|
+
BracketRight,
|
|
128
|
+
Backslash,
|
|
129
|
+
Semicolon,
|
|
130
|
+
Quote,
|
|
131
|
+
Slash,
|
|
132
|
+
At, // Name not verified
|
|
133
|
+
|
|
134
|
+
AndroidNum,
|
|
135
|
+
AndroidHeadsetHook,
|
|
136
|
+
/**
|
|
137
|
+
* Camera Focus key。
|
|
138
|
+
*/
|
|
139
|
+
AndroidFocus,
|
|
140
|
+
|
|
141
|
+
Plus, // Name not verified
|
|
142
|
+
ContextMenu,
|
|
143
|
+
AndroidNotification,
|
|
144
|
+
AndroidSearch,
|
|
145
|
+
|
|
146
|
+
PageUp = 92,
|
|
147
|
+
PageDown,
|
|
148
|
+
|
|
54
149
|
Escape = 111,
|
|
55
|
-
|
|
150
|
+
Delete,
|
|
151
|
+
ControlLeft,
|
|
152
|
+
ControlRight,
|
|
153
|
+
CapsLock,
|
|
154
|
+
ScrollLock,
|
|
155
|
+
MetaLeft,
|
|
156
|
+
MetaRight,
|
|
157
|
+
AndroidFunction,
|
|
158
|
+
PrintScreen,
|
|
159
|
+
Pause,
|
|
160
|
+
|
|
161
|
+
Home,
|
|
162
|
+
End,
|
|
163
|
+
Insert,
|
|
164
|
+
AndroidForward,
|
|
165
|
+
|
|
166
|
+
F1 = 131,
|
|
167
|
+
F2,
|
|
168
|
+
F3,
|
|
169
|
+
F4,
|
|
170
|
+
F5,
|
|
171
|
+
F6,
|
|
172
|
+
F7,
|
|
173
|
+
F8,
|
|
174
|
+
F9,
|
|
175
|
+
F10,
|
|
176
|
+
F11,
|
|
177
|
+
F12,
|
|
178
|
+
|
|
179
|
+
NumLock,
|
|
180
|
+
Numpad0,
|
|
181
|
+
Numpad1,
|
|
182
|
+
Numpad2,
|
|
183
|
+
Numpad3,
|
|
184
|
+
Numpad4,
|
|
185
|
+
Numpad5,
|
|
186
|
+
Numpad6,
|
|
187
|
+
Numpad7,
|
|
188
|
+
Numpad8,
|
|
189
|
+
Numpad9,
|
|
190
|
+
NumpadDivide,
|
|
191
|
+
NumpadMultiply,
|
|
192
|
+
NumpadSubtract,
|
|
193
|
+
NumpadAdd,
|
|
194
|
+
NumpadDecimal,
|
|
195
|
+
NumpadComma, // Name not verified
|
|
196
|
+
NumpadEnter,
|
|
197
|
+
NumpadEquals, // Name not verified
|
|
198
|
+
NumpadLeftParen, // Name not verified
|
|
199
|
+
NumpadRightParen, // Name not verified
|
|
56
200
|
|
|
57
|
-
|
|
58
|
-
|
|
201
|
+
VolumeMute = 164, // Name not verified
|
|
202
|
+
AndroidAppSwitch = 187,
|
|
59
203
|
|
|
60
|
-
|
|
61
|
-
|
|
204
|
+
AndroidCut = 277,
|
|
205
|
+
AndroidCopy,
|
|
206
|
+
AndroidPaste,
|
|
62
207
|
}
|
|
63
208
|
|
|
64
209
|
export const ScrcpyInjectKeyCodeControlMessage = new Struct()
|
|
@@ -69,4 +214,4 @@ export const ScrcpyInjectKeyCodeControlMessage = new Struct()
|
|
|
69
214
|
.uint32("metaState");
|
|
70
215
|
|
|
71
216
|
export type ScrcpyInjectKeyCodeControlMessage =
|
|
72
|
-
typeof ScrcpyInjectKeyCodeControlMessage["TInit"];
|
|
217
|
+
(typeof ScrcpyInjectKeyCodeControlMessage)["TInit"];
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import Struct from
|
|
1
|
+
import Struct from "@yume-chan/struct";
|
|
2
2
|
|
|
3
|
-
import { ScrcpyControlMessageType } from
|
|
3
|
+
import { ScrcpyControlMessageType } from "./type.js";
|
|
4
4
|
|
|
5
|
-
export const ScrcpyInjectTextControlMessage =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.string('text', { lengthField: 'length' });
|
|
5
|
+
export const ScrcpyInjectTextControlMessage = new Struct()
|
|
6
|
+
.uint8("type", ScrcpyControlMessageType.InjectText as const)
|
|
7
|
+
.uint32("length")
|
|
8
|
+
.string("text", { lengthField: "length" });
|
|
10
9
|
|
|
11
10
|
export type ScrcpyInjectTextControlMessage =
|
|
12
|
-
typeof ScrcpyInjectTextControlMessage[
|
|
11
|
+
(typeof ScrcpyInjectTextControlMessage)["TInit"];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import Struct from
|
|
1
|
+
import Struct from "@yume-chan/struct";
|
|
2
2
|
|
|
3
|
-
import { ScrcpyControlMessageType } from
|
|
3
|
+
import { ScrcpyControlMessageType } from "./type.js";
|
|
4
4
|
|
|
5
|
-
export const ScrcpyRotateDeviceControlMessage =
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export const ScrcpyRotateDeviceControlMessage = new Struct().uint8(
|
|
6
|
+
"type",
|
|
7
|
+
ScrcpyControlMessageType.RotateDevice as const
|
|
8
|
+
);
|
|
8
9
|
|
|
9
10
|
export type ScrcpyRotateDeviceControlMessage =
|
|
10
|
-
typeof ScrcpyRotateDeviceControlMessage[
|
|
11
|
+
(typeof ScrcpyRotateDeviceControlMessage)["TInit"];
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Consumable,
|
|
3
|
+
WritableStream,
|
|
4
|
+
WritableStreamDefaultWriter,
|
|
4
5
|
} from "@yume-chan/stream-extra";
|
|
6
|
+
import { ConsumableWritableStream } from "@yume-chan/stream-extra";
|
|
5
7
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import type {
|
|
9
|
+
ScrcpyOptions,
|
|
10
|
+
ScrcpyOptionsInit1_16,
|
|
11
|
+
ScrcpyScrollController,
|
|
9
12
|
} from "../options/index.js";
|
|
10
13
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from "./inject-keycode.js";
|
|
15
|
-
import { type ScrcpyInjectScrollControlMessage } from "./inject-scroll.js";
|
|
14
|
+
import type { AndroidKeyEventAction } from "./inject-keycode.js";
|
|
15
|
+
import { ScrcpyInjectKeyCodeControlMessage } from "./inject-keycode.js";
|
|
16
|
+
import type { ScrcpyInjectScrollControlMessage } from "./inject-scroll.js";
|
|
16
17
|
import { ScrcpyInjectTextControlMessage } from "./inject-text.js";
|
|
17
18
|
import { ScrcpyInjectTouchControlMessage } from "./inject-touch.js";
|
|
18
19
|
import { ScrcpyRotateDeviceControlMessage } from "./rotate-device.js";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
type AndroidScreenPowerMode,
|
|
22
|
-
} from "./set-screen-power-mode.js";
|
|
20
|
+
import type { AndroidScreenPowerMode } from "./set-screen-power-mode.js";
|
|
21
|
+
import { ScrcpySetScreenPowerModeControlMessage } from "./set-screen-power-mode.js";
|
|
23
22
|
import { ScrcpyControlMessageType } from "./type.js";
|
|
24
23
|
|
|
25
24
|
export class ScrcpyControlMessageSerializer {
|
|
26
|
-
private options: ScrcpyOptions<
|
|
25
|
+
private options: ScrcpyOptions<ScrcpyOptionsInit1_16>;
|
|
27
26
|
/** Control message type values for current version of server */
|
|
28
27
|
private types: ScrcpyControlMessageType[];
|
|
29
|
-
private writer: WritableStreamDefaultWriter<Uint8Array
|
|
28
|
+
private writer: WritableStreamDefaultWriter<Consumable<Uint8Array>>;
|
|
30
29
|
private scrollController: ScrcpyScrollController;
|
|
31
30
|
|
|
32
31
|
public constructor(
|
|
33
|
-
stream: WritableStream<Uint8Array
|
|
34
|
-
options: ScrcpyOptions<
|
|
32
|
+
stream: WritableStream<Consumable<Uint8Array>>,
|
|
33
|
+
options: ScrcpyOptions<ScrcpyOptionsInit1_16>
|
|
35
34
|
) {
|
|
36
35
|
this.writer = stream.getWriter();
|
|
37
36
|
|
|
@@ -56,10 +55,14 @@ export class ScrcpyControlMessageSerializer {
|
|
|
56
55
|
return message as T;
|
|
57
56
|
}
|
|
58
57
|
|
|
58
|
+
private async write(data: Uint8Array) {
|
|
59
|
+
await ConsumableWritableStream.write(this.writer, data);
|
|
60
|
+
}
|
|
61
|
+
|
|
59
62
|
public injectKeyCode(
|
|
60
63
|
message: Omit<ScrcpyInjectKeyCodeControlMessage, "type">
|
|
61
64
|
) {
|
|
62
|
-
return this.
|
|
65
|
+
return this.write(
|
|
63
66
|
ScrcpyInjectKeyCodeControlMessage.serialize(
|
|
64
67
|
this.addMessageType(
|
|
65
68
|
message,
|
|
@@ -70,7 +73,7 @@ export class ScrcpyControlMessageSerializer {
|
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
public injectText(text: string) {
|
|
73
|
-
return this.
|
|
76
|
+
return this.write(
|
|
74
77
|
ScrcpyInjectTextControlMessage.serialize({
|
|
75
78
|
text,
|
|
76
79
|
type: this.getActualMessageType(
|
|
@@ -84,7 +87,7 @@ export class ScrcpyControlMessageSerializer {
|
|
|
84
87
|
* `pressure` is a float value between 0 and 1.
|
|
85
88
|
*/
|
|
86
89
|
public injectTouch(message: Omit<ScrcpyInjectTouchControlMessage, "type">) {
|
|
87
|
-
return this.
|
|
90
|
+
return this.write(
|
|
88
91
|
ScrcpyInjectTouchControlMessage.serialize(
|
|
89
92
|
this.addMessageType(
|
|
90
93
|
message,
|
|
@@ -108,7 +111,7 @@ export class ScrcpyControlMessageSerializer {
|
|
|
108
111
|
return;
|
|
109
112
|
}
|
|
110
113
|
|
|
111
|
-
return this.
|
|
114
|
+
return this.write(data);
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
public async backOrScreenOn(action: AndroidKeyEventAction) {
|
|
@@ -120,12 +123,12 @@ export class ScrcpyControlMessageSerializer {
|
|
|
120
123
|
});
|
|
121
124
|
|
|
122
125
|
if (buffer) {
|
|
123
|
-
return await this.
|
|
126
|
+
return await this.write(buffer);
|
|
124
127
|
}
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
public setScreenPowerMode(mode: AndroidScreenPowerMode) {
|
|
128
|
-
return this.
|
|
131
|
+
return this.write(
|
|
129
132
|
ScrcpySetScreenPowerModeControlMessage.serialize({
|
|
130
133
|
mode,
|
|
131
134
|
type: this.getActualMessageType(
|
|
@@ -136,7 +139,7 @@ export class ScrcpyControlMessageSerializer {
|
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
public rotateDevice() {
|
|
139
|
-
return this.
|
|
142
|
+
return this.write(
|
|
140
143
|
ScrcpyRotateDeviceControlMessage.serialize({
|
|
141
144
|
type: this.getActualMessageType(
|
|
142
145
|
ScrcpyControlMessageType.RotateDevice
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import Struct, { placeholder } from
|
|
1
|
+
import Struct, { placeholder } from "@yume-chan/struct";
|
|
2
2
|
|
|
3
|
-
import { ScrcpyControlMessageType } from
|
|
3
|
+
import { ScrcpyControlMessageType } from "./type.js";
|
|
4
4
|
|
|
5
5
|
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/SurfaceControl.java;l=659;drc=20303e05bf73796124ab70a279cf849b61b97905
|
|
6
6
|
export enum AndroidScreenPowerMode {
|
|
7
7
|
Off = 0,
|
|
8
|
-
Normal = 2
|
|
8
|
+
Normal = 2,
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const ScrcpySetScreenPowerModeControlMessage =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.uint8('mode', placeholder<AndroidScreenPowerMode>());
|
|
11
|
+
export const ScrcpySetScreenPowerModeControlMessage = new Struct()
|
|
12
|
+
.uint8("type", ScrcpyControlMessageType.SetScreenPowerMode as const)
|
|
13
|
+
.uint8("mode", placeholder<AndroidScreenPowerMode>());
|
|
15
14
|
|
|
16
15
|
export type ScrcpySetScreenPowerModeControlMessage =
|
|
17
|
-
typeof ScrcpySetScreenPowerModeControlMessage[
|
|
16
|
+
(typeof ScrcpySetScreenPowerModeControlMessage)["TInit"];
|
|
@@ -7,4 +7,4 @@ export const ScrcpyAckClipboardDeviceMessage = new Struct()
|
|
|
7
7
|
.extra({ type: ScrcpyDeviceMessageType.AckClipboard as const });
|
|
8
8
|
|
|
9
9
|
export type ScrcpyAckClipboardDeviceMessage =
|
|
10
|
-
typeof ScrcpyAckClipboardDeviceMessage["TDeserializeResult"];
|
|
10
|
+
(typeof ScrcpyAckClipboardDeviceMessage)["TDeserializeResult"];
|
|
@@ -8,4 +8,4 @@ export const ScrcpyClipboardDeviceMessage = new Struct()
|
|
|
8
8
|
.extra({ type: ScrcpyDeviceMessageType.Clipboard as const });
|
|
9
9
|
|
|
10
10
|
export type ScrcpyClipboardDeviceMessage =
|
|
11
|
-
typeof ScrcpyClipboardDeviceMessage["TDeserializeResult"];
|
|
11
|
+
(typeof ScrcpyClipboardDeviceMessage)["TDeserializeResult"];
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./adb/index.js";
|
|
2
|
+
export * from "./codec.js";
|
|
3
|
+
export * from "./control/index.js";
|
|
4
|
+
export * from "./device-message/index.js";
|
|
5
|
+
export * from "./options/index.js";
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type AndroidCodecProfile,
|
|
4
|
-
} from "../../codec.js";
|
|
5
|
-
import { type ScrcpyOptionValue } from "../types.js";
|
|
1
|
+
import type { AndroidCodecLevel, AndroidCodecProfile } from "../../codec.js";
|
|
2
|
+
import type { ScrcpyOptionValue } from "../types.js";
|
|
6
3
|
|
|
7
4
|
/**
|
|
8
5
|
* If the option you need is not in this type,
|
|
@@ -16,6 +13,7 @@ export interface CodecOptionsInit {
|
|
|
16
13
|
maxBframes: number;
|
|
17
14
|
repeatPreviousFrameAfter: number;
|
|
18
15
|
maxPtsGapToEncoder: number;
|
|
16
|
+
intraRefreshPeriod: number;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
function toDashCase(input: string) {
|
|
@@ -32,7 +30,7 @@ const CODEC_OPTION_TYPES: Partial<
|
|
|
32
30
|
export class CodecOptions implements ScrcpyOptionValue {
|
|
33
31
|
public value: Partial<CodecOptionsInit>;
|
|
34
32
|
|
|
35
|
-
public constructor(value: Partial<CodecOptionsInit>) {
|
|
33
|
+
public constructor(value: Partial<CodecOptionsInit> = {}) {
|
|
36
34
|
this.value = value;
|
|
37
35
|
}
|
|
38
36
|
|
|
@@ -4,17 +4,16 @@ import {
|
|
|
4
4
|
} from "@yume-chan/stream-extra";
|
|
5
5
|
import Struct from "@yume-chan/struct";
|
|
6
6
|
|
|
7
|
+
import type {
|
|
8
|
+
ScrcpyBackOrScreenOnControlMessage,
|
|
9
|
+
ScrcpySetClipboardControlMessage,
|
|
10
|
+
} from "../../control/index.js";
|
|
7
11
|
import {
|
|
8
12
|
AndroidKeyEventAction,
|
|
9
13
|
ScrcpyControlMessageType,
|
|
10
|
-
type ScrcpyBackOrScreenOnControlMessage,
|
|
11
|
-
type ScrcpySetClipboardControlMessage,
|
|
12
14
|
} from "../../control/index.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
type ScrcpyOptions,
|
|
16
|
-
type ScrcpyVideoStreamPacket,
|
|
17
|
-
} from "../types.js";
|
|
15
|
+
import type { ScrcpyOptions, ScrcpyVideoStreamPacket } from "../types.js";
|
|
16
|
+
import { toScrcpyOptionValue } from "../types.js";
|
|
18
17
|
|
|
19
18
|
import { CodecOptions } from "./codec-options.js";
|
|
20
19
|
import {
|
|
@@ -22,10 +21,8 @@ import {
|
|
|
22
21
|
parseSequenceParameterSet,
|
|
23
22
|
removeH264Emulation,
|
|
24
23
|
} from "./h264-configuration.js";
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
type ScrcpyScrollController,
|
|
28
|
-
} from "./scroll.js";
|
|
24
|
+
import type { ScrcpyScrollController } from "./scroll.js";
|
|
25
|
+
import { ScrcpyScrollController1_16 } from "./scroll.js";
|
|
29
26
|
|
|
30
27
|
export enum ScrcpyLogLevel {
|
|
31
28
|
Verbose = "verbose",
|
|
@@ -69,6 +66,14 @@ export interface ScrcpyOptionsInit1_16 {
|
|
|
69
66
|
*/
|
|
70
67
|
lockVideoOrientation: ScrcpyVideoOrientation;
|
|
71
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Use ADB forward tunnel instead of reverse tunnel.
|
|
71
|
+
*
|
|
72
|
+
* This option is mainly used for working around the bug that on Android <9,
|
|
73
|
+
* ADB daemon can't create reverse tunnels if connected wirelessly (ADB over WiFi).
|
|
74
|
+
*
|
|
75
|
+
* When using `AdbScrcpyClient`, it can detect this situation and enable this option automatically.
|
|
76
|
+
*/
|
|
72
77
|
tunnelForward: boolean;
|
|
73
78
|
|
|
74
79
|
crop: string;
|
|
@@ -120,7 +125,7 @@ export const ScrcpySetClipboardControlMessage1_15 = new Struct()
|
|
|
120
125
|
.string("content", { lengthField: "length" });
|
|
121
126
|
|
|
122
127
|
export type ScrcpySetClipboardControlMessage1_15 =
|
|
123
|
-
typeof ScrcpySetClipboardControlMessage1_15["TInit"];
|
|
128
|
+
(typeof ScrcpySetClipboardControlMessage1_15)["TInit"];
|
|
124
129
|
|
|
125
130
|
export class ScrcpyOptions1_16<
|
|
126
131
|
T extends ScrcpyOptionsInit1_16 = ScrcpyOptionsInit1_16
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import Struct from "@yume-chan/struct";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type ScrcpyInjectScrollControlMessage,
|
|
6
|
-
} from "../../control/index.js";
|
|
3
|
+
import type { ScrcpyInjectScrollControlMessage } from "../../control/index.js";
|
|
4
|
+
import { ScrcpyControlMessageType } from "../../control/index.js";
|
|
7
5
|
|
|
8
6
|
export interface ScrcpyScrollController {
|
|
9
7
|
serializeScrollMessage(
|
package/src/options/1_18.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Struct, { placeholder } from "@yume-chan/struct";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type ScrcpyBackOrScreenOnControlMessage,
|
|
3
|
+
import type {
|
|
4
|
+
AndroidKeyEventAction,
|
|
5
|
+
ScrcpyBackOrScreenOnControlMessage,
|
|
7
6
|
} from "../control/index.js";
|
|
7
|
+
import { ScrcpyControlMessageType } from "../control/index.js";
|
|
8
8
|
|
|
9
|
+
import type { ScrcpyOptionsInit1_16 } from "./1_16/options.js";
|
|
9
10
|
import {
|
|
10
11
|
ScrcpyBackOrScreenOnControlMessage1_16,
|
|
11
12
|
ScrcpyOptions1_16,
|
|
12
|
-
type ScrcpyOptionsInit1_16,
|
|
13
13
|
} from "./1_16/options.js";
|
|
14
14
|
|
|
15
15
|
export interface ScrcpyOptionsInit1_18 extends ScrcpyOptionsInit1_16 {
|
|
@@ -21,7 +21,7 @@ export const ScrcpyBackOrScreenOnControlMessage1_18 = new Struct()
|
|
|
21
21
|
.uint8("action", placeholder<AndroidKeyEventAction>());
|
|
22
22
|
|
|
23
23
|
export type ScrcpyBackOrScreenOnControlMessage1_18 =
|
|
24
|
-
typeof ScrcpyBackOrScreenOnControlMessage1_18["TInit"];
|
|
24
|
+
(typeof ScrcpyBackOrScreenOnControlMessage1_18)["TInit"];
|
|
25
25
|
|
|
26
26
|
export class ScrcpyOptions1_18<
|
|
27
27
|
T extends ScrcpyOptionsInit1_18 = ScrcpyOptionsInit1_18
|
package/src/options/1_21.ts
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import Struct from "@yume-chan/struct";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
type ScrcpySetClipboardControlMessage,
|
|
8
|
-
} from "../control/index.js";
|
|
5
|
+
import type { ScrcpySetClipboardControlMessage } from "../control/index.js";
|
|
6
|
+
import { ScrcpyControlMessageType } from "../control/index.js";
|
|
9
7
|
|
|
10
|
-
import {
|
|
8
|
+
import type { ScrcpyOptionsInit1_18 } from "./1_18.js";
|
|
9
|
+
import { ScrcpyOptions1_18 } from "./1_18.js";
|
|
11
10
|
import { toScrcpyOptionValue } from "./types.js";
|
|
12
11
|
|
|
13
12
|
export interface ScrcpyOptionsInit1_21 extends ScrcpyOptionsInit1_18 {
|
|
@@ -26,7 +25,7 @@ export const ScrcpySetClipboardControlMessage1_21 = new Struct()
|
|
|
26
25
|
.string("content", { lengthField: "length" });
|
|
27
26
|
|
|
28
27
|
export type ScrcpySetClipboardControlMessage1_21 =
|
|
29
|
-
typeof ScrcpySetClipboardControlMessage1_21["TInit"];
|
|
28
|
+
(typeof ScrcpySetClipboardControlMessage1_21)["TInit"];
|
|
30
29
|
|
|
31
30
|
export class ScrcpyOptions1_21<
|
|
32
31
|
T extends ScrcpyOptionsInit1_21 = ScrcpyOptionsInit1_21
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ScrcpyScrollController } from "../1_16/index.js";
|
|
2
|
+
import type { ScrcpyOptionsInit1_21 } from "../1_21.js";
|
|
3
|
+
import { ScrcpyOptions1_21 } from "../1_21.js";
|
|
3
4
|
|
|
4
5
|
import { ScrcpyScrollController1_22 } from "./scroll.js";
|
|
5
6
|
|
|
@@ -10,7 +10,7 @@ export const ScrcpyInjectScrollControlMessage1_22 = new Struct()
|
|
|
10
10
|
.int32("buttons");
|
|
11
11
|
|
|
12
12
|
export type ScrcpyInjectScrollControlMessage1_22 =
|
|
13
|
-
typeof ScrcpyInjectScrollControlMessage1_22["TInit"];
|
|
13
|
+
(typeof ScrcpyInjectScrollControlMessage1_22)["TInit"];
|
|
14
14
|
|
|
15
15
|
export class ScrcpyScrollController1_22 extends ScrcpyScrollController1_16 {
|
|
16
16
|
public override serializeScrollMessage(
|