名称: 屏幕捕获API 描述: 用于截图和录制的跨平台屏幕与窗口捕获功能 允许工具: 读取, 写入, 编辑, Bash, Glob, Grep 标签: [屏幕捕获, 截图, 录制, 桌面, 媒体]
屏幕捕获API
实现跨平台屏幕和窗口捕获功能,支持截图和录制。
功能
- 捕获全屏
- 捕获特定窗口
- 捕获屏幕区域
- 处理多显示器
- 流式传输屏幕内容
- 处理权限
输入模式
{
"type": "object",
"properties": {
"projectPath": { "type": "string" },
"framework": { "enum": ["electron", "native"] },
"captureTypes": { "type": "array" }
},
"required": ["projectPath"]
}
Electron示例
const { desktopCapturer } = require('electron');
async function captureScreen() {
const sources = await desktopCapturer.getSources({
types: ['screen'],
thumbnailSize: { width: 1920, height: 1080 }
});
for (const source of sources) {
const screenshot = source.thumbnail.toPNG();
// 保存或使用截图
}
}
相关技能
电源管理监控系统服务集成进程