forked from Blendman974/faceclaw
Add screen-recording option
This commit is contained in:
1 parent
4c946631e0
commit
b738ce4bb2
12 files changed
+644
-99
No files matched your search
@@ -390,10 +390,28 @@ export class FaceclawCommunicatorBridge {
|
||||
return bitmap ? new ImageSource(bitmap) : null;
|
||||
}
|
||||
|
||||
/** Save the current composite as a raw 4bpp screenshot; returns the path (empty if none). */
|
||||
saveRawCompositeScreenshot(): string {
|
||||
/** Save the current composite as a 4-bit grayscale PNG; returns the path (empty if none). */
|
||||
saveScreenshot(): string {
|
||||
if (!global.isAndroid) return "";
|
||||
return String(this.communicator.saveRawCompositeScreenshot());
|
||||
return String(this.communicator.saveCompositePngScreenshot());
|
||||
}
|
||||
|
||||
/** Begin collecting composite frames for an animated-GIF screen recording. */
|
||||
startScreenRecording(): void {
|
||||
if (!global.isAndroid) return;
|
||||
this.communicator.startScreenRecording();
|
||||
}
|
||||
|
||||
/** Capture the current composite into the active recording; no-op when idle. */
|
||||
recordScreenFrame(): void {
|
||||
if (!global.isAndroid) return;
|
||||
this.communicator.recordScreenFrame();
|
||||
}
|
||||
|
||||
/** Finish the recording and save the animated GIF; returns the path (empty if no frames). */
|
||||
stopScreenRecording(): string {
|
||||
if (!global.isAndroid) return "";
|
||||
return String(this.communicator.stopScreenRecording());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Utils } from "@nativescript/core";
|
||||
|
||||
import { type GrayImage } from "../graphics/image";
|
||||
|
||||
declare const com: any;
|
||||
|
||||
/**
|
||||
* Save an image as the raw headerless 576x288 4bpp frame buffer (the exact
|
||||
* bytes the wire compressor sees) for compression experiments. Returns the
|
||||
* absolute path of the written file; retrieve with
|
||||
* adb pull /sdcard/Android/data/com.faceclaw.app/files/screenshots/
|
||||
*/
|
||||
export function saveRawScreenshot(image: GrayImage): string {
|
||||
const context = Utils.android.getApplicationContext();
|
||||
if (!context) throw new Error("Android application context unavailable");
|
||||
return String(
|
||||
com.faceclaw.app.ScreenshotUtil.saveRawScreenshot(
|
||||
context,
|
||||
image.pixels.buffer,
|
||||
image.width,
|
||||
image.height,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user