@yume-chan/scrcpy 0.0.20 → 0.0.21

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.
Files changed (124) hide show
  1. package/CHANGELOG.json +15 -0
  2. package/CHANGELOG.md +9 -1
  3. package/README.md +8 -122
  4. package/esm/codec/av1.js +2 -2
  5. package/esm/codec/av1.js.map +1 -1
  6. package/esm/codec/h264.js +2 -2
  7. package/esm/codec/h264.js.map +1 -1
  8. package/esm/codec/h265.js +2 -2
  9. package/esm/codec/h265.js.map +1 -1
  10. package/esm/codec/nalu.d.ts +1 -8
  11. package/esm/codec/nalu.d.ts.map +1 -1
  12. package/esm/codec/nalu.js +53 -40
  13. package/esm/codec/nalu.js.map +1 -1
  14. package/esm/control/hover-helper.d.ts +1 -1
  15. package/esm/control/hover-helper.d.ts.map +1 -1
  16. package/esm/control/hover-helper.js +8 -9
  17. package/esm/control/hover-helper.js.map +1 -1
  18. package/esm/control/inject-keycode.js +3 -3
  19. package/esm/control/inject-keycode.js.map +1 -1
  20. package/esm/control/inject-touch.js +3 -3
  21. package/esm/control/inject-touch.js.map +1 -1
  22. package/esm/control/serializer.d.ts +1 -3
  23. package/esm/control/serializer.d.ts.map +1 -1
  24. package/esm/control/serializer.js +14 -14
  25. package/esm/control/serializer.js.map +1 -1
  26. package/esm/control/set-screen-power-mode.js +1 -1
  27. package/esm/control/set-screen-power-mode.js.map +1 -1
  28. package/esm/control/type.d.ts +1 -1
  29. package/esm/control/type.d.ts.map +1 -1
  30. package/esm/control/type.js +4 -4
  31. package/esm/control/type.js.map +1 -1
  32. package/esm/control/writer.d.ts +1 -3
  33. package/esm/control/writer.d.ts.map +1 -1
  34. package/esm/control/writer.js +17 -17
  35. package/esm/control/writer.js.map +1 -1
  36. package/esm/device-message/type.js +1 -1
  37. package/esm/device-message/type.js.map +1 -1
  38. package/esm/options/1_16/codec-options.d.ts.map +1 -1
  39. package/esm/options/1_16/codec-options.js.map +1 -1
  40. package/esm/options/1_16/init.js +2 -2
  41. package/esm/options/1_16/init.js.map +1 -1
  42. package/esm/options/1_16/options.d.ts.map +1 -1
  43. package/esm/options/1_16/options.js +1 -2
  44. package/esm/options/1_16/options.js.map +1 -1
  45. package/esm/options/1_16/scroll.d.ts +1 -2
  46. package/esm/options/1_16/scroll.d.ts.map +1 -1
  47. package/esm/options/1_16/scroll.js +12 -12
  48. package/esm/options/1_16/scroll.js.map +1 -1
  49. package/esm/options/1_17.d.ts.map +1 -1
  50. package/esm/options/1_17.js +1 -2
  51. package/esm/options/1_17.js.map +1 -1
  52. package/esm/options/1_18.d.ts.map +1 -1
  53. package/esm/options/1_18.js +3 -4
  54. package/esm/options/1_18.js.map +1 -1
  55. package/esm/options/1_21.d.ts.map +1 -1
  56. package/esm/options/1_21.js +1 -2
  57. package/esm/options/1_21.js.map +1 -1
  58. package/esm/options/1_22/options.d.ts.map +1 -1
  59. package/esm/options/1_22/options.js +1 -2
  60. package/esm/options/1_22/options.js.map +1 -1
  61. package/esm/options/1_22/scroll.d.ts.map +1 -1
  62. package/esm/options/1_22/scroll.js.map +1 -1
  63. package/esm/options/1_23.d.ts.map +1 -1
  64. package/esm/options/1_23.js +1 -2
  65. package/esm/options/1_23.js.map +1 -1
  66. package/esm/options/1_24.d.ts.map +1 -1
  67. package/esm/options/1_24.js +1 -2
  68. package/esm/options/1_24.js.map +1 -1
  69. package/esm/options/1_25/options.d.ts.map +1 -1
  70. package/esm/options/1_25/options.js.map +1 -1
  71. package/esm/options/2_0.d.ts.map +1 -1
  72. package/esm/options/2_0.js +2 -4
  73. package/esm/options/2_0.js.map +1 -1
  74. package/esm/options/2_1.d.ts +48 -0
  75. package/esm/options/2_1.d.ts.map +1 -0
  76. package/esm/options/2_1.js +23 -0
  77. package/esm/options/2_1.js.map +1 -0
  78. package/esm/options/codec.d.ts.map +1 -1
  79. package/esm/options/codec.js +2 -3
  80. package/esm/options/codec.js.map +1 -1
  81. package/esm/options/index.d.ts +1 -0
  82. package/esm/options/index.d.ts.map +1 -1
  83. package/esm/options/index.js +1 -0
  84. package/esm/options/index.js.map +1 -1
  85. package/esm/options/latest.d.ts +4 -5
  86. package/esm/options/latest.d.ts.map +1 -1
  87. package/esm/options/latest.js +2 -3
  88. package/esm/options/latest.js.map +1 -1
  89. package/esm/options/types.d.ts +1 -0
  90. package/esm/options/types.d.ts.map +1 -1
  91. package/esm/options/types.js +10 -0
  92. package/esm/options/types.js.map +1 -1
  93. package/package.json +9 -12
  94. package/src/codec/h265.ts +14 -14
  95. package/src/codec/nalu.ts +73 -55
  96. package/src/control/hover-helper.ts +10 -11
  97. package/src/control/serializer.ts +31 -35
  98. package/src/control/type.ts +7 -7
  99. package/src/control/writer.ts +30 -32
  100. package/src/device-message/stream.ts +2 -2
  101. package/src/options/1_16/codec-options.ts +4 -4
  102. package/src/options/1_16/float-to-uint16.ts +1 -1
  103. package/src/options/1_16/options.ts +31 -35
  104. package/src/options/1_16/scroll.ts +16 -16
  105. package/src/options/1_17.ts +11 -11
  106. package/src/options/1_18.ts +12 -12
  107. package/src/options/1_21.ts +9 -9
  108. package/src/options/1_22/options.ts +7 -7
  109. package/src/options/1_22/scroll.ts +2 -2
  110. package/src/options/1_23.ts +6 -6
  111. package/src/options/1_24.ts +4 -4
  112. package/src/options/1_25/options.ts +4 -4
  113. package/src/options/1_25/scroll.ts +2 -2
  114. package/src/options/2_0.ts +25 -25
  115. package/src/options/2_1.ts +35 -0
  116. package/src/options/codec.ts +13 -13
  117. package/src/options/index.ts +1 -0
  118. package/src/options/latest.ts +4 -6
  119. package/src/options/types.ts +39 -28
  120. package/tsconfig.build.tsbuildinfo +1 -1
  121. package/bin/scrcpy-server +0 -0
  122. package/bin/version.d.ts +0 -1
  123. package/bin/version.js +0 -1
  124. package/scripts/fetch-server.cjs +0 -38
@@ -16,72 +16,70 @@ import { ScrcpyControlMessageSerializer } from "./serializer.js";
16
16
  import type { AndroidScreenPowerMode } from "./set-screen-power-mode.js";
17
17
 
18
18
  export class ScrcpyControlMessageWriter {
19
- private _writer: WritableStreamDefaultWriter<Consumable<Uint8Array>>;
20
- private _serializer: ScrcpyControlMessageSerializer;
19
+ #writer: WritableStreamDefaultWriter<Consumable<Uint8Array>>;
20
+ #serializer: ScrcpyControlMessageSerializer;
21
21
 
22
- public constructor(
22
+ constructor(
23
23
  writer: WritableStreamDefaultWriter<Consumable<Uint8Array>>,
24
- options: ScrcpyOptions<object>
24
+ options: ScrcpyOptions<object>,
25
25
  ) {
26
- this._writer = writer;
27
- this._serializer = new ScrcpyControlMessageSerializer(options);
26
+ this.#writer = writer;
27
+ this.#serializer = new ScrcpyControlMessageSerializer(options);
28
28
  }
29
29
 
30
- private async write(message: Uint8Array) {
31
- await ConsumableWritableStream.write(this._writer, message);
30
+ async #write(message: Uint8Array) {
31
+ await ConsumableWritableStream.write(this.#writer, message);
32
32
  }
33
33
 
34
- public async injectKeyCode(
35
- message: Omit<ScrcpyInjectKeyCodeControlMessage, "type">
34
+ async injectKeyCode(
35
+ message: Omit<ScrcpyInjectKeyCodeControlMessage, "type">,
36
36
  ) {
37
- await this.write(this._serializer.injectKeyCode(message));
37
+ await this.#write(this.#serializer.injectKeyCode(message));
38
38
  }
39
39
 
40
- public async injectText(text: string) {
41
- await this.write(this._serializer.injectText(text));
40
+ async injectText(text: string) {
41
+ await this.#write(this.#serializer.injectText(text));
42
42
  }
43
43
 
44
44
  /**
45
45
  * `pressure` is a float value between 0 and 1.
46
46
  */
47
- public async injectTouch(
48
- message: Omit<ScrcpyInjectTouchControlMessage, "type">
49
- ) {
50
- await this.write(this._serializer.injectTouch(message));
47
+ async injectTouch(message: Omit<ScrcpyInjectTouchControlMessage, "type">) {
48
+ await this.#write(this.#serializer.injectTouch(message));
51
49
  }
52
50
 
53
51
  /**
54
52
  * `scrollX` and `scrollY` are float values between 0 and 1.
55
53
  */
56
- public async injectScroll(
57
- message: Omit<ScrcpyInjectScrollControlMessage, "type">
54
+ async injectScroll(
55
+ message: Omit<ScrcpyInjectScrollControlMessage, "type">,
58
56
  ) {
59
- const data = this._serializer.injectScroll(message);
57
+ const data = this.#serializer.injectScroll(message);
60
58
  if (data) {
61
- await this.write(data);
59
+ await this.#write(data);
62
60
  }
63
61
  }
64
62
 
65
- public async backOrScreenOn(action: AndroidKeyEventAction) {
66
- const data = this._serializer.backOrScreenOn(action);
63
+ async backOrScreenOn(action: AndroidKeyEventAction) {
64
+ const data = this.#serializer.backOrScreenOn(action);
67
65
  if (data) {
68
- await this.write(data);
66
+ await this.#write(data);
69
67
  }
70
68
  }
71
69
 
72
- public async setScreenPowerMode(mode: AndroidScreenPowerMode) {
73
- await this.write(this._serializer.setScreenPowerMode(mode));
70
+ async setScreenPowerMode(mode: AndroidScreenPowerMode) {
71
+ await this.#write(this.#serializer.setScreenPowerMode(mode));
74
72
  }
75
73
 
76
- public async rotateDevice() {
77
- await this.write(this._serializer.rotateDevice());
74
+ async rotateDevice() {
75
+ await this.#write(this.#serializer.rotateDevice());
78
76
  }
79
77
 
80
- public releaseLock() {
81
- this._writer.releaseLock();
78
+ releaseLock() {
79
+ this.#writer.releaseLock();
82
80
  }
83
81
 
84
- public async close() {
85
- await this._writer.close();
82
+ async close() {
83
+ await this.#writer.close();
86
84
  }
87
85
  }
@@ -21,11 +21,11 @@ export class ScrcpyDeviceMessageDeserializeStream extends BufferedTransformStrea
21
21
  switch (type[0]) {
22
22
  case ScrcpyDeviceMessageType.Clipboard:
23
23
  return await ScrcpyClipboardDeviceMessage.deserialize(
24
- stream
24
+ stream,
25
25
  );
26
26
  case ScrcpyDeviceMessageType.AckClipboard:
27
27
  return await ScrcpyAckClipboardDeviceMessage.deserialize(
28
- stream
28
+ stream,
29
29
  );
30
30
  default:
31
31
  throw new Error("Unsupported control message type");
@@ -27,15 +27,15 @@ const CODEC_OPTION_TYPES: Partial<
27
27
  };
28
28
 
29
29
  export class CodecOptions implements ScrcpyOptionValue {
30
- public value: Partial<CodecOptionsInit>;
30
+ value: Partial<CodecOptionsInit>;
31
31
 
32
- public constructor(value: Partial<CodecOptionsInit> = {}) {
32
+ constructor(value: Partial<CodecOptionsInit> = {}) {
33
33
  this.value = value;
34
34
  }
35
35
 
36
- public toOptionValue(): string | undefined {
36
+ toOptionValue(): string | undefined {
37
37
  const entries = Object.entries(this.value).filter(
38
- ([, value]) => value !== undefined
38
+ ([, value]) => value !== undefined,
39
39
  );
40
40
 
41
41
  if (entries.length === 0) {
@@ -29,5 +29,5 @@ export const ScrcpyFloatToUint16NumberType: NumberFieldType = {
29
29
  };
30
30
 
31
31
  export const ScrcpyFloatToUint16FieldDefinition = new NumberFieldDefinition(
32
- ScrcpyFloatToUint16NumberType
32
+ ScrcpyFloatToUint16NumberType,
33
33
  );
@@ -38,7 +38,7 @@ import type { ScrcpyScrollController } from "./scroll.js";
38
38
  import { ScrcpyScrollController1_16 } from "./scroll.js";
39
39
 
40
40
  export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
41
- public static readonly DEFAULTS = {
41
+ static readonly DEFAULTS = {
42
42
  logLevel: ScrcpyLogLevel1_16.Debug,
43
43
  maxSize: 0,
44
44
  bitRate: 8_000_000,
@@ -54,7 +54,7 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
54
54
  codecOptions: new CodecOptions(),
55
55
  } as const satisfies Required<ScrcpyOptionsInit1_16>;
56
56
 
57
- public static readonly SERIALIZE_ORDER = [
57
+ static readonly SERIALIZE_ORDER = [
58
58
  "logLevel",
59
59
  "maxSize",
60
60
  "bitRate",
@@ -70,68 +70,64 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
70
70
  "codecOptions",
71
71
  ] as const satisfies readonly (keyof ScrcpyOptionsInit1_16)[];
72
72
 
73
- public static serialize<T>(options: T, order: readonly (keyof T)[]) {
73
+ static serialize<T>(options: T, order: readonly (keyof T)[]) {
74
74
  return order.map((key) => toScrcpyOptionValue(options[key], "-"));
75
75
  }
76
76
 
77
- public static async parseCString(
77
+ static async parseCString(
78
78
  stream: AsyncExactReadable,
79
- maxLength: number
79
+ maxLength: number,
80
80
  ): Promise<string> {
81
81
  let result = decodeUtf8(await stream.readExactly(maxLength));
82
82
  result = result.substring(0, result.indexOf("\0"));
83
83
  return result;
84
84
  }
85
85
 
86
- public static async parseUint16BE(
87
- stream: AsyncExactReadable
88
- ): Promise<number> {
86
+ static async parseUint16BE(stream: AsyncExactReadable): Promise<number> {
89
87
  const buffer = await stream.readExactly(NumberFieldType.Uint16.size);
90
88
  return NumberFieldType.Uint16.deserialize(buffer, false);
91
89
  }
92
90
 
93
- public static async parseUint32BE(
94
- stream: AsyncExactReadable
95
- ): Promise<number> {
91
+ static async parseUint32BE(stream: AsyncExactReadable): Promise<number> {
96
92
  const buffer = await stream.readExactly(NumberFieldType.Uint32.size);
97
93
  return NumberFieldType.Uint32.deserialize(buffer, false);
98
94
  }
99
95
 
100
- public value: Required<ScrcpyOptionsInit1_16>;
96
+ value: Required<ScrcpyOptionsInit1_16>;
101
97
 
102
- public readonly defaults: Required<ScrcpyOptionsInit1_16> =
98
+ readonly defaults: Required<ScrcpyOptionsInit1_16> =
103
99
  ScrcpyOptions1_16.DEFAULTS;
104
100
 
105
- public readonly controlMessageTypes: readonly ScrcpyControlMessageType[] =
101
+ readonly controlMessageTypes: readonly ScrcpyControlMessageType[] =
106
102
  SCRCPY_CONTROL_MESSAGE_TYPES_1_16;
107
103
 
108
- public constructor(init: ScrcpyOptionsInit1_16) {
104
+ constructor(init: ScrcpyOptionsInit1_16) {
109
105
  this.value = { ...ScrcpyOptions1_16.DEFAULTS, ...init };
110
106
  }
111
107
 
112
- public serialize(): string[] {
108
+ serialize(): string[] {
113
109
  return ScrcpyOptions1_16.serialize(
114
110
  this.value,
115
- ScrcpyOptions1_16.SERIALIZE_ORDER
111
+ ScrcpyOptions1_16.SERIALIZE_ORDER,
116
112
  );
117
113
  }
118
114
 
119
- public setListEncoders(): void {
115
+ setListEncoders(): void {
120
116
  throw new Error("Not supported");
121
117
  }
122
118
 
123
- public setListDisplays(): void {
119
+ setListDisplays(): void {
124
120
  // Set to an invalid value
125
121
  // Server will print valid values before crashing
126
122
  // (server will crash before opening sockets)
127
123
  this.value.displayId = -1;
128
124
  }
129
125
 
130
- public parseEncoder(): ScrcpyEncoder | undefined {
126
+ parseEncoder(): ScrcpyEncoder | undefined {
131
127
  throw new Error("Not supported");
132
128
  }
133
129
 
134
- public parseDisplay(line: string): ScrcpyDisplay | undefined {
130
+ parseDisplay(line: string): ScrcpyDisplay | undefined {
135
131
  const displayIdRegex = /\s+scrcpy --display (\d+)/;
136
132
  const match = line.match(displayIdRegex);
137
133
  if (match) {
@@ -142,8 +138,8 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
142
138
  return undefined;
143
139
  }
144
140
 
145
- public parseVideoStreamMetadata(
146
- stream: ReadableStream<Uint8Array>
141
+ parseVideoStreamMetadata(
142
+ stream: ReadableStream<Uint8Array>,
147
143
  ): ValueOrPromise<ScrcpyVideoStream> {
148
144
  return (async () => {
149
145
  const buffered = new BufferedReadableStream(stream);
@@ -152,7 +148,7 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
152
148
  };
153
149
  metadata.deviceName = await ScrcpyOptions1_16.parseCString(
154
150
  buffered,
155
- 64
151
+ 64,
156
152
  );
157
153
  metadata.width = await ScrcpyOptions1_16.parseUint16BE(buffered);
158
154
  metadata.height = await ScrcpyOptions1_16.parseUint16BE(buffered);
@@ -160,11 +156,11 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
160
156
  })();
161
157
  }
162
158
 
163
- public parseAudioStreamMetadata(): never {
159
+ parseAudioStreamMetadata(): never {
164
160
  throw new Error("Not supported");
165
161
  }
166
162
 
167
- public createMediaStreamTransformer(): TransformStream<
163
+ createMediaStreamTransformer(): TransformStream<
168
164
  Uint8Array,
169
165
  ScrcpyMediaStreamPacket
170
166
  > {
@@ -181,7 +177,7 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
181
177
  }
182
178
 
183
179
  const deserializeStream = new StructDeserializeStream(
184
- ScrcpyMediaStreamRawPacket
180
+ ScrcpyMediaStreamRawPacket,
185
181
  );
186
182
  return {
187
183
  writable: deserializeStream.writable,
@@ -202,19 +198,19 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
202
198
  data: packet.data,
203
199
  });
204
200
  },
205
- })
201
+ }),
206
202
  ),
207
203
  };
208
204
  }
209
205
 
210
- public serializeInjectTouchControlMessage(
211
- message: ScrcpyInjectTouchControlMessage
206
+ serializeInjectTouchControlMessage(
207
+ message: ScrcpyInjectTouchControlMessage,
212
208
  ): Uint8Array {
213
209
  return ScrcpyInjectTouchControlMessage1_16.serialize(message);
214
210
  }
215
211
 
216
- public serializeBackOrScreenOnControlMessage(
217
- message: ScrcpyBackOrScreenOnControlMessage
212
+ serializeBackOrScreenOnControlMessage(
213
+ message: ScrcpyBackOrScreenOnControlMessage,
218
214
  ) {
219
215
  if (message.action === AndroidKeyEventAction.Down) {
220
216
  return ScrcpyBackOrScreenOnControlMessage1_16.serialize(message);
@@ -223,13 +219,13 @@ export class ScrcpyOptions1_16 implements ScrcpyOptions<ScrcpyOptionsInit1_16> {
223
219
  return undefined;
224
220
  }
225
221
 
226
- public serializeSetClipboardControlMessage(
227
- message: ScrcpySetClipboardControlMessage
222
+ serializeSetClipboardControlMessage(
223
+ message: ScrcpySetClipboardControlMessage,
228
224
  ): Uint8Array {
229
225
  return ScrcpySetClipboardControlMessage1_15.serialize(message);
230
226
  }
231
227
 
232
- public createScrollController(): ScrcpyScrollController {
228
+ createScrollController(): ScrcpyScrollController {
233
229
  return new ScrcpyScrollController1_16();
234
230
  }
235
231
  }
@@ -4,7 +4,7 @@ import type { ScrcpyInjectScrollControlMessage } from "../../control/index.js";
4
4
 
5
5
  export interface ScrcpyScrollController {
6
6
  serializeScrollMessage(
7
- message: ScrcpyInjectScrollControlMessage
7
+ message: ScrcpyInjectScrollControlMessage,
8
8
  ): Uint8Array | undefined;
9
9
  }
10
10
 
@@ -24,31 +24,31 @@ export const ScrcpyInjectScrollControlMessage1_16 = new Struct()
24
24
  * reaches 1 or -1.
25
25
  */
26
26
  export class ScrcpyScrollController1_16 implements ScrcpyScrollController {
27
- private accumulatedX = 0;
28
- private accumulatedY = 0;
27
+ #accumulatedX = 0;
28
+ #accumulatedY = 0;
29
29
 
30
30
  protected processMessage(
31
- message: ScrcpyInjectScrollControlMessage
31
+ message: ScrcpyInjectScrollControlMessage,
32
32
  ): ScrcpyInjectScrollControlMessage | undefined {
33
- this.accumulatedX += message.scrollX;
34
- this.accumulatedY += message.scrollY;
33
+ this.#accumulatedX += message.scrollX;
34
+ this.#accumulatedY += message.scrollY;
35
35
 
36
36
  let scrollX = 0;
37
37
  let scrollY = 0;
38
- if (this.accumulatedX >= 1) {
38
+ if (this.#accumulatedX >= 1) {
39
39
  scrollX = 1;
40
- this.accumulatedX = 0;
41
- } else if (this.accumulatedX <= -1) {
40
+ this.#accumulatedX = 0;
41
+ } else if (this.#accumulatedX <= -1) {
42
42
  scrollX = -1;
43
- this.accumulatedX = 0;
43
+ this.#accumulatedX = 0;
44
44
  }
45
45
 
46
- if (this.accumulatedY >= 1) {
46
+ if (this.#accumulatedY >= 1) {
47
47
  scrollY = 1;
48
- this.accumulatedY = 0;
49
- } else if (this.accumulatedY <= -1) {
48
+ this.#accumulatedY = 0;
49
+ } else if (this.#accumulatedY <= -1) {
50
50
  scrollY = -1;
51
- this.accumulatedY = 0;
51
+ this.#accumulatedY = 0;
52
52
  }
53
53
 
54
54
  if (scrollX === 0 && scrollY === 0) {
@@ -60,8 +60,8 @@ export class ScrcpyScrollController1_16 implements ScrcpyScrollController {
60
60
  return message;
61
61
  }
62
62
 
63
- public serializeScrollMessage(
64
- message: ScrcpyInjectScrollControlMessage
63
+ serializeScrollMessage(
64
+ message: ScrcpyInjectScrollControlMessage,
65
65
  ): Uint8Array | undefined {
66
66
  const processed = this.processMessage(message);
67
67
  if (!processed) {
@@ -11,19 +11,19 @@ export class ScrcpyOptions1_17 extends ScrcpyOptionsBase<
11
11
  ScrcpyOptionsInit1_17,
12
12
  ScrcpyOptions1_16
13
13
  > {
14
- public static readonly DEFAULTS = {
14
+ static readonly DEFAULTS = {
15
15
  ...ScrcpyOptions1_16.DEFAULTS,
16
16
  encoderName: undefined,
17
17
  } as const satisfies Required<ScrcpyOptionsInit1_17>;
18
18
 
19
- public static readonly SERIALIZE_ORDER = [
19
+ static readonly SERIALIZE_ORDER = [
20
20
  ...ScrcpyOptions1_16.SERIALIZE_ORDER,
21
21
  "encoderName",
22
22
  ] as const satisfies readonly (keyof ScrcpyOptionsInit1_17)[];
23
23
 
24
- public static parseEncoder(
24
+ static parseEncoder(
25
25
  line: string,
26
- encoderNameRegex: RegExp
26
+ encoderNameRegex: RegExp,
27
27
  ): ScrcpyEncoder | undefined {
28
28
  const match = line.match(encoderNameRegex);
29
29
  if (match) {
@@ -32,35 +32,35 @@ export class ScrcpyOptions1_17 extends ScrcpyOptionsBase<
32
32
  return undefined;
33
33
  }
34
34
 
35
- public override get defaults(): Required<ScrcpyOptionsInit1_17> {
35
+ override get defaults(): Required<ScrcpyOptionsInit1_17> {
36
36
  return ScrcpyOptions1_17.DEFAULTS;
37
37
  }
38
38
 
39
- public constructor(init: ScrcpyOptionsInit1_17) {
39
+ constructor(init: ScrcpyOptionsInit1_17) {
40
40
  super(new ScrcpyOptions1_16(init), {
41
41
  ...ScrcpyOptions1_17.DEFAULTS,
42
42
  ...init,
43
43
  });
44
44
  }
45
45
 
46
- public override serialize(): string[] {
46
+ override serialize(): string[] {
47
47
  return ScrcpyOptions1_16.serialize(
48
48
  this.value,
49
- ScrcpyOptions1_17.SERIALIZE_ORDER
49
+ ScrcpyOptions1_17.SERIALIZE_ORDER,
50
50
  );
51
51
  }
52
52
 
53
- public override setListEncoders() {
53
+ override setListEncoders() {
54
54
  // Set to an invalid value
55
55
  // Server will print valid values before crashing
56
56
  // (server will crash after opening video and control sockets)
57
57
  this.value.encoderName = "_";
58
58
  }
59
59
 
60
- public override parseEncoder(line: string): ScrcpyEncoder | undefined {
60
+ override parseEncoder(line: string): ScrcpyEncoder | undefined {
61
61
  return ScrcpyOptions1_17.parseEncoder(
62
62
  line,
63
- /\s+scrcpy --encoder-name '(.*?)'/
63
+ /\s+scrcpy --encoder-name '(.*?)'/,
64
64
  );
65
65
  }
66
66
  }
@@ -56,7 +56,7 @@ export const SCRCPY_CONTROL_MESSAGE_TYPES_1_18 =
56
56
  SCRCPY_CONTROL_MESSAGE_TYPES_1_18.splice(
57
57
  6,
58
58
  0,
59
- ScrcpyControlMessageType.ExpandSettingPanel
59
+ ScrcpyControlMessageType.ExpandSettingPanel,
60
60
  );
61
61
 
62
62
  const LOG_LEVEL_MAP = {
@@ -82,23 +82,23 @@ export class ScrcpyOptions1_18 extends ScrcpyOptionsBase<
82
82
  ScrcpyOptionsInit1_18,
83
83
  ScrcpyOptions1_17
84
84
  > {
85
- public static readonly DEFAULTS = {
85
+ static readonly DEFAULTS = {
86
86
  ...ScrcpyOptions1_17.DEFAULTS,
87
87
  logLevel: ScrcpyLogLevel1_18.Debug,
88
88
  lockVideoOrientation: ScrcpyVideoOrientation1_18.Unlocked,
89
89
  powerOffOnClose: false,
90
90
  } as const satisfies Required<ScrcpyOptionsInit1_18>;
91
91
 
92
- public static readonly SERIALIZE_ORDER = [
92
+ static readonly SERIALIZE_ORDER = [
93
93
  ...ScrcpyOptions1_17.SERIALIZE_ORDER,
94
94
  "powerOffOnClose",
95
95
  ] as const satisfies readonly (keyof ScrcpyOptionsInit1_18)[];
96
96
 
97
- public override get defaults(): Required<ScrcpyOptionsInit1_18> {
97
+ override get defaults(): Required<ScrcpyOptionsInit1_18> {
98
98
  return ScrcpyOptions1_18.DEFAULTS;
99
99
  }
100
100
 
101
- public override get controlMessageTypes() {
101
+ override get controlMessageTypes() {
102
102
  return SCRCPY_CONTROL_MESSAGE_TYPES_1_18;
103
103
  }
104
104
 
@@ -111,26 +111,26 @@ export class ScrcpyOptions1_18 extends ScrcpyOptionsBase<
111
111
  lockVideoOrientation:
112
112
  VIDEO_ORIENTATION_MAP[value.lockVideoOrientation],
113
113
  }),
114
- value
114
+ value,
115
115
  );
116
116
  }
117
117
 
118
- public serialize(): string[] {
118
+ override serialize(): string[] {
119
119
  return ScrcpyOptions1_16.serialize(
120
120
  this.value,
121
- ScrcpyOptions1_18.SERIALIZE_ORDER
121
+ ScrcpyOptions1_18.SERIALIZE_ORDER,
122
122
  );
123
123
  }
124
124
 
125
- public override parseEncoder(line: string): ScrcpyEncoder | undefined {
125
+ override parseEncoder(line: string): ScrcpyEncoder | undefined {
126
126
  return ScrcpyOptions1_17.parseEncoder(
127
127
  line,
128
- /\s+scrcpy --encoder '(.*?)'/
128
+ /\s+scrcpy --encoder '(.*?)'/,
129
129
  );
130
130
  }
131
131
 
132
- public override serializeBackOrScreenOnControlMessage(
133
- message: ScrcpyBackOrScreenOnControlMessage
132
+ override serializeBackOrScreenOnControlMessage(
133
+ message: ScrcpyBackOrScreenOnControlMessage,
134
134
  ) {
135
135
  return ScrcpyBackOrScreenOnControlMessage1_18.serialize(message);
136
136
  }
@@ -30,14 +30,14 @@ export class ScrcpyOptions1_21 extends ScrcpyOptionsBase<
30
30
  ScrcpyOptionsInit1_21,
31
31
  ScrcpyOptions1_18
32
32
  > {
33
- public static readonly DEFAULTS = {
33
+ static readonly DEFAULTS = {
34
34
  ...ScrcpyOptions1_18.DEFAULTS,
35
35
  clipboardAutosync: true,
36
36
  } as const satisfies Required<ScrcpyOptionsInit1_21>;
37
37
 
38
- public static serialize<T extends object>(
38
+ static serialize<T extends object>(
39
39
  options: T,
40
- defaults: Required<T>
40
+ defaults: Required<T>,
41
41
  ): string[] {
42
42
  // 1.21 changed the format of arguments
43
43
  const result: string[] = [];
@@ -49,7 +49,7 @@ export class ScrcpyOptions1_21 extends ScrcpyOptionsBase<
49
49
 
50
50
  const defaultValue = toScrcpyOptionValue(
51
51
  defaults[key as keyof T],
52
- undefined
52
+ undefined,
53
53
  );
54
54
  if (serializedValue == defaultValue) {
55
55
  continue;
@@ -60,23 +60,23 @@ export class ScrcpyOptions1_21 extends ScrcpyOptionsBase<
60
60
  return result;
61
61
  }
62
62
 
63
- public override get defaults(): Required<ScrcpyOptionsInit1_21> {
63
+ override get defaults(): Required<ScrcpyOptionsInit1_21> {
64
64
  return ScrcpyOptions1_21.DEFAULTS;
65
65
  }
66
66
 
67
- public constructor(init: ScrcpyOptionsInit1_21) {
67
+ constructor(init: ScrcpyOptionsInit1_21) {
68
68
  super(new ScrcpyOptions1_18(init), {
69
69
  ...ScrcpyOptions1_21.DEFAULTS,
70
70
  ...init,
71
71
  });
72
72
  }
73
73
 
74
- public override serialize(): string[] {
74
+ override serialize(): string[] {
75
75
  return ScrcpyOptions1_21.serialize(this.value, this.defaults);
76
76
  }
77
77
 
78
- public override serializeSetClipboardControlMessage(
79
- message: ScrcpySetClipboardControlMessage
78
+ override serializeSetClipboardControlMessage(
79
+ message: ScrcpySetClipboardControlMessage,
80
80
  ): Uint8Array {
81
81
  return ScrcpySetClipboardControlMessage1_21.serialize(message);
82
82
  }
@@ -14,26 +14,26 @@ export class ScrcpyOptions1_22 extends ScrcpyOptionsBase<
14
14
  ScrcpyOptionsInit1_22,
15
15
  ScrcpyOptions1_21
16
16
  > {
17
- public static readonly DEFAULTS = {
17
+ static readonly DEFAULTS = {
18
18
  ...ScrcpyOptions1_21.DEFAULTS,
19
19
  downsizeOnError: true,
20
20
  sendDeviceMeta: true,
21
21
  sendDummyByte: true,
22
22
  } as const satisfies Required<ScrcpyOptionsInit1_22>;
23
23
 
24
- public override get defaults(): Required<ScrcpyOptionsInit1_22> {
24
+ override get defaults(): Required<ScrcpyOptionsInit1_22> {
25
25
  return ScrcpyOptions1_22.DEFAULTS;
26
26
  }
27
27
 
28
- public constructor(init: ScrcpyOptionsInit1_22) {
28
+ constructor(init: ScrcpyOptionsInit1_22) {
29
29
  super(new ScrcpyOptions1_21(init), {
30
30
  ...ScrcpyOptions1_22.DEFAULTS,
31
31
  ...init,
32
32
  });
33
33
  }
34
34
 
35
- public override parseVideoStreamMetadata(
36
- stream: ReadableStream<Uint8Array>
35
+ override parseVideoStreamMetadata(
36
+ stream: ReadableStream<Uint8Array>,
37
37
  ): ValueOrPromise<ScrcpyVideoStream> {
38
38
  if (!this.value.sendDeviceMeta) {
39
39
  return { stream, metadata: { codec: ScrcpyVideoCodecId.H264 } };
@@ -42,11 +42,11 @@ export class ScrcpyOptions1_22 extends ScrcpyOptionsBase<
42
42
  }
43
43
  }
44
44
 
45
- public override serialize(): string[] {
45
+ override serialize(): string[] {
46
46
  return ScrcpyOptions1_21.serialize(this.value, this.defaults);
47
47
  }
48
48
 
49
- public override createScrollController(): ScrcpyScrollController {
49
+ override createScrollController(): ScrcpyScrollController {
50
50
  return new ScrcpyScrollController1_22();
51
51
  }
52
52
  }
@@ -13,8 +13,8 @@ export type ScrcpyInjectScrollControlMessage1_22 =
13
13
  (typeof ScrcpyInjectScrollControlMessage1_22)["TInit"];
14
14
 
15
15
  export class ScrcpyScrollController1_22 extends ScrcpyScrollController1_16 {
16
- public override serializeScrollMessage(
17
- message: ScrcpyInjectScrollControlMessage1_22
16
+ override serializeScrollMessage(
17
+ message: ScrcpyInjectScrollControlMessage1_22,
18
18
  ): Uint8Array | undefined {
19
19
  const processed = this.processMessage(message);
20
20
  if (!processed) {