From 04f15595e33c35c2d8fcc12549a0daf0bc3dba44 Mon Sep 17 00:00:00 2001 From: Simon Chan <1330321+yume-chan@users.noreply.github.com> Date: Thu, 20 Jul 2023 19:53:00 +0800 Subject: [PATCH] chore(scrcpy): add more docs --- libraries/adb-scrcpy/src/client.ts | 33 +++++++++++++++++++ .../src/options/{2.0.spec.ts => 2_0.spec.ts} | 0 .../src/options/{2.1.spec.ts => 2_1.spec.ts} | 0 libraries/scrcpy/src/options/latest.ts | 2 -- 4 files changed, 33 insertions(+), 2 deletions(-) rename libraries/scrcpy/src/options/{2.0.spec.ts => 2_0.spec.ts} (100%) rename libraries/scrcpy/src/options/{2.1.spec.ts => 2_1.spec.ts} (100%) diff --git a/libraries/adb-scrcpy/src/client.ts b/libraries/adb-scrcpy/src/client.ts index f9d08f2a..5f5cf28d 100644 --- a/libraries/adb-scrcpy/src/client.ts +++ b/libraries/adb-scrcpy/src/client.ts @@ -260,21 +260,54 @@ export class AdbScrcpyClient { } #videoStream: Promise | undefined; + /** + * Gets a `Promise` that resolves to the parsed video stream. + * + * On server version 2.1 and above, it will be `undefined` if + * video is disabled by `options.video: false`. + * + * Note: if it's not `undefined`, it must be consumed to prevent + * the connection from being blocked. + */ get videoStream() { return this.#videoStream; } #audioStream: Promise | undefined; + /** + * Gets a `Promise` that resolves to the parsed audio stream. + * + * On server versions before 2.0, it will always be `undefined`. + * On server version 2.0 and above, it will be `undefined` if + * audio is disabled by `options.audio: false`. + * + * Note: if it's not `undefined`, it must be consumed to prevent + * the connection from being blocked. + */ get audioStream() { return this.#audioStream; } #controlMessageWriter: ScrcpyControlMessageWriter | undefined; + /** + * Gets the control message writer. + * + * On server version 1.22 and above, it will be `undefined` if + * control is disabled by `options.control: false`. + */ get controlMessageWriter() { return this.#controlMessageWriter; } #deviceMessageStream: ReadableStream | undefined; + /** + * Gets the device message stream. + * + * On server version 1.22 and above, it will be `undefined` if + * control is disabled by `options.control: false`. + * + * Note: it must be consumed to prevent the connection from being blocked. + */ get deviceMessageStream() { return this.#deviceMessageStream; } diff --git a/libraries/scrcpy/src/options/2.0.spec.ts b/libraries/scrcpy/src/options/2_0.spec.ts similarity index 100% rename from libraries/scrcpy/src/options/2.0.spec.ts rename to libraries/scrcpy/src/options/2_0.spec.ts diff --git a/libraries/scrcpy/src/options/2.1.spec.ts b/libraries/scrcpy/src/options/2_1.spec.ts similarity index 100% rename from libraries/scrcpy/src/options/2.1.spec.ts rename to libraries/scrcpy/src/options/2_1.spec.ts diff --git a/libraries/scrcpy/src/options/latest.ts b/libraries/scrcpy/src/options/latest.ts index 99f55c76..e7f5b27d 100644 --- a/libraries/scrcpy/src/options/latest.ts +++ b/libraries/scrcpy/src/options/latest.ts @@ -10,5 +10,3 @@ export type ScrcpyVideoOrientation = ScrcpyVideoOrientation1_18; export type ScrcpyOptionsInitLatest = ScrcpyOptionsInit2_1; export class ScrcpyOptionsLatest extends ScrcpyOptions2_1 {} - -export const ScrcpyLatestVersion = "2.1";