feat:语音对话优化
This commit is contained in:
@@ -132,7 +132,7 @@ function getOffscreen(): HTMLCanvasElement {
|
||||
export function sampleFrame(video: HTMLVideoElement): Uint8ClampedArray | null {
|
||||
if (video.readyState < 2) return null;
|
||||
const canvas = getOffscreen();
|
||||
const ctx = canvas.getContext("2d");
|
||||
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
||||
if (!ctx) return null;
|
||||
ctx.drawImage(video, 0, 0, DETECT_WIDTH, DETECT_HEIGHT);
|
||||
return ctx.getImageData(0, 0, DETECT_WIDTH, DETECT_HEIGHT).data;
|
||||
|
||||
Reference in New Issue
Block a user