Skip to main content

CaptureFrameHelper

CaptureFrameHelper is a helper class to capture camera output.

TypeNameInterface Description
Functionsconstructor()

Static FunctionscaptureCameraOutput(camera: Camera, cropRect?: Rect, resolutionRatio?: number): Texture | null

Function: capture camera output to a texture

Parameters

camera: The camera to capture output from.

cropRect: The crop rectangle to apply to the captured frame in normalized texture coordinates (default is Rect(0, 0, 1, 1)). x and y represent the crop origin, width and height represent the crop size, and each value is typically in the range [0, 1]. For example, Rect(0, 0, 1, 1) captures the full output, Rect(0, 0, 0.5, 0.5) captures the bottom-left quarter, and x + width / y + height should not exceed 1.

resolutionRatio: The resolution ratio to apply to the captured frame (default is 1.0).

Returns The captured texture, or null if capture failed.

Examples

constructor()

let obj = new APJS.CaptureFrameHelper();

captureCameraOutput(camera: Camera, cropRect?: Rect, resolutionRatio?: number): Texture | null

const texture = CaptureFrameHelper.captureCameraOutput(camera, new Rect(0, 0, 1, 1), 0.5);

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use CaptureFrameHelper here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies