### Desktop Capture Sources Example Source: https://www.u-tools.cn/docs/developer/api-reference/utools/screen.html An asynchronous example demonstrating how to get desktop capture sources (windows or screens) and set up a media stream for recording. ```javascript (async () => { const ousrces = await utools.desktopCaptureSources({ types: ["window", "screen"], }); const stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: { mandatory: { chromeMediaSource: "desktop", chromeMediaSourceId: ousrces[0].id, minWidth: 1280, maxWidth: 1280, minHeight: 720, maxHeight: 720, }, }, }); const video = document.querySelector("video"); video.srcObject = stream; video.onloadedmetadata = (e) => video.play(); })(); ``` -------------------------------- ### Installing Third-Party Modules via npm Source: https://www.u-tools.cn/docs/developer/information/preload-js/nodejs.html Example of installing and using the 'colord' third-party module in preload.js. ```bash npm install colord ``` ```javascript const { getFormat, colord } = require("colord"); window.services = { colord: { darken(text) { const fmt = getFormat(text); if (!fmt) { return [null, "请输入一个有效的颜色值,比如 #000 或 rgb(0,0,0)"]; } else { const darkColor = colord(text).darken(0.1); return [darkColor, null]; } }, }, }; ``` -------------------------------- ### Make Request - PHP Example Source: https://www.u-tools.cn/docs/developer/server-api.html PHP code example for making a GET request to the baseinfo endpoint. ```php $ch = curl_init(); $url = "https://open.u-tools.cn/baseinfo?" . http_build_query($params); $headers = array( "Content-Type: application/json", "Accept: application/json", ) curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (!curl_errno($ch)) { $json = json_decode($response, true); echo $json; } c_url_close($ch); ``` -------------------------------- ### Get All Docs with Prefix (Synchronous) Source: https://www.u-tools.cn/docs/developer/api-reference/db/local-db.html Example of fetching all documents that start with a specific prefix using the synchronous allDocs method. ```typescript // 获取所有 id 以 "test/" 作为前缀的文档 const docs1 = utools.db.allDocs("test/"); // 根据 id 数组获取对应文档数组 const docs2 = utools.db.allDocs(["test/doc-2", "test/doc-3"]); // 获取插件应用所有文档 const docs3 = utools.db.allDocs(); console.log(docs1, docs2, docs3) ``` -------------------------------- ### Get All Docs with Prefix (Asynchronous) Source: https://www.u-tools.cn/docs/developer/api-reference/db/local-db.html Example of fetching all documents that start with a specific prefix using the asynchronous promises.allDocs method. ```typescript // 获取所有 id 以 "test/" 作为前缀的文档 const docs1 = await utools.db.promises.allDocs("test/"); // 根据 id 数组获取对应文档数组 const docs2 = await utools.db.promises.allDocs(["test/doc-2", "test/doc-3"]); // 获取插件应用所有文档 const docs3 = await utools.db.promises.allDocs(); console.log(docs1, docs2, docs3) ``` -------------------------------- ### Get User Basic Information - Making the Request (PHP) Source: https://www.u-tools.cn/docs/developer/api-reference/server.html PHP code example for making the GET /baseinfo API request. ```php $ch = curl_init(); $url = "https://open.u-tools.cn/baseinfo?" . http_build_query($params); $headers = array( "Content-Type: application/json", "Accept: application/json", ) curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (!curl_errno($ch)) { $json = json_decode($response, true); echo $json; } curl_close($ch); ``` -------------------------------- ### Screen Color Pick Example Source: https://www.u-tools.cn/docs/developer/utools-api/screen.html Example of using `utools.screenColorPick` to get the hex and RGB values of a selected color. ```javascript utools.screenColorPick((colors) => { const { hex, rgb } = colors; console.log(hex, rgb); }); ``` -------------------------------- ### Get User Basic Information - Making the Request (Node.js) Source: https://www.u-tools.cn/docs/developer/api-reference/server.html Node.js code example for making the GET /baseinfo API request. ```js const fetch = require('node-fetch') const params = { plugin_id: "zueadppw", // 可在开发者插件应用中获得 access_token: "user access_token 32位", timestamp: "1624329435", sign: "xxx" } fetch('https://open.u-tools.cn/baseinfo?' + new URLSearchParams(params), { method: 'GET', headers: { 'Content-Type': 'application/json' }, ).then(res => res.json()).then(data => { console.log(data) }) ``` -------------------------------- ### Basic Usage Example Source: https://www.u-tools.cn/docs/developer/utools-api/ubrowser.html An example demonstrating the chained method calls for navigating, inputting text, and pressing enter. ```javascript utools.ubrowser.goto('https://www.baidu.com').input('uTools').press('enter').run({ width: 1200, height: 800 }) ``` -------------------------------- ### Start Webpack Dev Server Source: https://www.u-tools.cn/docs/developer/basic/debug-plugin.html Command to start the webpack-dev-server. ```shell npm run serve ``` -------------------------------- ### Get All Displays Example Source: https://www.u-tools.cn/docs/developer/api-reference/utools/screen.html Fetches and logs information about all connected displays using `utools.getAllDisplays()`. ```javascript const displays = utools.getAllDisplays(); console.log(displays); ``` -------------------------------- ### Start Project with Vite Source: https://www.u-tools.cn/docs/developer/basic/debug-plugin.html Command to start the development server for a Vite project. ```shell npm run dev ``` -------------------------------- ### Complete plugin.json Configuration Example Source: https://www.u-tools.cn/docs/developer/information/plugin-json.html This JSON object demonstrates the structure and possible configurations for a plugin's manifest file, including different types of command matching like text, regex, files, images, and window properties. ```json { "main": "index.html", "logo": "logo.png", "preload": "preload.js", "features": [ { "code": "test-text", "explain": "功能指令 —— 可搜索打开的指令示例", "cmds": ["功能指令"] }, { "code": "test-regex", "explain": "匹配指令 —— 正则匹配示例", "cmds": [ { "type": "regex", "label": "打开链接", "match": "/^(?:(http|https|ftp):\/\/)?((?:[\w-]+\.)+[a-z0-9]+)((?:\/[^\/?#]*)+)?(\?[^#]+)?(#.+)?$/i", "minLength": 7, "maxLength": 2000 }, { "type": "regex", "label": "身份证号查询", "match": "/^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/", "minLength": 18, "maxLength": 18 }, { "type": "regex", "label": "手机号查询", "match": "/^1[3456789]\d{9}$/", "minLength": 11, "maxLength": 11 }, { "type": "regex", "label": "手机号查询", "match": "/^1[3456789]\d{9}$/", "minLength": 11, "maxLength": 11 }, { "type": "regex", "match": "/^\(*[+-]?(?:\d{1,15}|\d{1,3}(?:,\d\d\d){1,4})(?:\.\d{1,15})?%?\)*(?:\s*[+*/^%-]\s*\(*[+-]?(?:\d{1,15}|\d{1,3}(?:,\d\d\d){1,4})(?:\.\d{1,15})?%?\)*)+$/", "label": "公式计算", "maxLength": 1000 } ] }, { "code": "test-files", "explain": "匹配指令 —— 文件(夹)匹配示例", "cmds": [ { "type": "files", "label": "任意文件重命名" }, { "type": "files", "fileType": "file", "extensions": ["png", "jpg", "jpeg", "svg", "webp", "tiff", "avif", "heic", "bmp", "gif"], "label": "图片批量处理" }, { "type": "files", "fileType": "directory", "label": "读取文件夹内所有文件", "maxLength": 1 }, { "type": "files", "fileType": "file", "extensions": ["pdf", "md", "doc", "docx", "xls", "xlsx", "txt"], "label": "AI 文档处理", "maxLength": 50 }, { "type": "files", "fileType": "file", "extensions": ["mp4", "webm", "avi", "flv", "mkv", "mov", "wmv"], "label": "视频批量处理" } ] }, { "code": "test-img", "explain": "匹配指令 —— 图像匹配示例", "cmds": [ { "type": "img", "label": "OCR 文字识别" }, { "type": "img", "label": "保存为图片文件" } ] }, { "code": "test-over", "explain": "匹配指令 —— 任意文本匹配示例", "cmds": [ { "type": "over", "label": "问问 AI" }, { "type": "over", "label": "Google 搜索", "exclude": "/\n/", "minLength": 1, "maxLength": 500 } ] }, { "code": "test-window", "explain": "匹配指令 —— 当前活动应用窗口匹配示例", "cmds": [ { "type": "window", "match": { "app": ["explorer.exe", "SearchApp.exe", "SearchHost.exe", "FESearchHost.exe", "prevhost.exe"], "class": ["CabinetWClass", "ExploreWClass"] }, "label": "终端中打开当前目录" }, { "type": "window", "match": { "app": ["chrome.exe", "firefox.exe", "msedge.exe", "Safari.app", "Google Chrome.app", "Microsoft Edge.app"], "title": "/^(?:GitHub - )?[A-Za-z0-9][A-Za-z0-9-]+\\//" }, "label": "Github Clone" } ] } ] } ``` -------------------------------- ### Get Current Window Type Example Source: https://www.u-tools.cn/docs/developer/api-reference/utools/window.html Demonstrates how to get the type of the current window ('main', 'detach', or 'browser'). ```javascript utools.onPluginEnter(({ code, type, payload }) => { if (utools.getWindowType() === "main") { utools.showNotification("当前窗口为主窗口"); } }); ``` -------------------------------- ### Create Browser Window Example Source: https://www.u-tools.cn/docs/developer/api-reference/utools/window.html Demonstrates how to create a new browser window, set its properties, and interact with its webContents. ```javascript const ubWindow = utools.createBrowserWindow( "test.html", { show: false, title: "测试窗口", webPreferences: { preload: "preload.js", }, }, () => { // 显示 ubWindow.show(); // 置顶 ubWindow.setAlwaysOnTop(true); // 窗口全屏 ubWindow.setFullScreen(true); // 向子窗口发送消息 ubWindow.webContents.send("ping", "test"); // 执行脚本 ubWindow.webContents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())').then((result) => { console.log(result); // Will be the JSON object from the fetch call }); } ); console.log(ubWindow); ``` -------------------------------- ### Example: Applying theme based on dark mode Source: https://www.u-tools.cn/docs/developer/utools-api/window.html Demonstrates how to use isDarkColors to apply a dark theme to the body. ```javascript utools.onPluginEnter(({ code, type, payload }) => { document.body.className = utools.isDarkColors() ? "dark-mode" : ""; }); ``` -------------------------------- ### Screen Color Pick Example Source: https://www.u-tools.cn/docs/developer/api-reference/utools/screen.html Demonstrates how to use `utools.screenColorPick` to get a color from the screen and log its hex and RGB values. ```javascript // 取色 utools.screenColorPick((colors) => { const { hex, rgb } = colors; console.log(hex, rgb); }); ``` -------------------------------- ### Get All AI Models Source: https://www.u-tools.cn/docs/developer/api-reference/utools/ai.html Example of how to retrieve a list of all available AI models. ```javascript const models = await utools.allAiModels(); console.log(models); ``` -------------------------------- ### Screen Capture Example Source: https://www.u-tools.cn/docs/developer/utools-api/screen.html Example of using `utools.screenCapture` to capture the screen and then redirect to an OCR service. ```javascript utools.screenCapture((image) => { utools.redirect(['OCR 文字识别', '文字识别+翻译'], image) }); ``` -------------------------------- ### Get Application Version Source: https://www.u-tools.cn/docs/developer/api-reference/utools/system.html Example of retrieving the version of the current application. ```javascript console.log(utools.getAppVersion()); ``` -------------------------------- ### Get All Dynamic Features Source: https://www.u-tools.cn/docs/developer/utools-api/features.html Example of how to retrieve all dynamic features available in the plugin. ```javascript // Get all dynamic features const features = utools.getFeatures(); console.log(features); ``` -------------------------------- ### Get User Basic Information - Response Data (Error) Source: https://www.u-tools.cn/docs/developer/api-reference/server.html Example JSON response when the GET /baseinfo request fails. ```json { "message": "The given data was invalid.", // message 字段始终存在 "errors": { // 可能没有详细错误信息 "access_token": ["access token 必须是 32 个字符。"] } } ``` -------------------------------- ### Local Schema Path (Example 1) Source: https://www.u-tools.cn/docs/developer/information/tools/jsonschema.html This example demonstrates how to reference a locally downloaded JSONSchema file using a relative path from the plugin.json file. Assumes plugin.json is in 'public' and schema is in 'resource'. ```json { "$schema": "../resource/utools.schema.json" } ``` -------------------------------- ### Get User Basic Information - Response Data (Success) Source: https://www.u-tools.cn/docs/developer/api-reference/server.html Example JSON response when the GET /baseinfo request is successful (status 200). ```json { "resource": { "avatar": "https://res.u-tools.cn/assets/avatars/eZCBIawAkspLw8Xg.png", "member": 1, // 是否 uTools 会员(0: 否,1: 是) "nickname": "却步.", "open_id": "00a50cd81c37c4e381e8161b2d762158", // uTools 用户 ID, 对于此插件应用不变且唯一 "timestamp": 1624329616 }, "sign": "4dbf21a9d5a0f0e3906a0180522fd6393b4e91f738d57cafddf309afc6c547bb" // 签名算法与 1.3 相同 } ``` -------------------------------- ### Get Application Name Source: https://www.u-tools.cn/docs/developer/api-reference/utools/system.html Example of retrieving the name of the current application. ```javascript console.log(utools.getAppName()); ``` -------------------------------- ### Example: Sending a message to the parent window Source: https://www.u-tools.cn/docs/developer/utools-api/window.html Illustrates how to use sendToParent to send messages from a child window to its parent. ```javascript // 通过 utools.createBrowserWindow 创建的窗口调用 utools.sendToParent("pong", "hello", 123); ``` -------------------------------- ### Copy File Example Source: https://www.u-tools.cn/docs/developer/api-reference/utools/copy.html Example of how to copy a file using utools.copyFile. ```javascript utools.copyFile("C:\\Users\\Administrator\\Desktop\\test.txt"); ``` -------------------------------- ### Send Message to Parent Window Example Source: https://www.u-tools.cn/docs/developer/api-reference/utools/window.html Example of how to send a message to the parent window from a window created by `utools.createBrowserWindow`. ```javascript // 通过 utools.createBrowserWindow 创建的窗口调用 utools.sendToParent("pong", "hello", 123); // 版本:>= 6.1.0 ``` -------------------------------- ### Local Schema Path (Example 2 - Following utools-api-type installation) Source: https://www.u-tools.cn/docs/developer/information/tools/jsonschema.html This example shows how to reference the JSONSchema file when it's included as part of the 'utools-api-type' npm package. Assumes plugin.json is in 'public' and schema is within 'node_modules'. ```json { "$schema": "../node_modules/utools-api-types/resource/utools.schema.json" } ``` -------------------------------- ### WebM Screen Recording Source: https://www.u-tools.cn/docs/developer/utools-api/screen.html Example code for recording the screen in WebM format. ```js async function screenRecording() { const ousrces = await utools.desktopCaptureSources({ types: ["window", "screen"], }); const stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: { mandatory: { chromeMediaSource: "desktop", chromeMediaSourceId: ousrces[0].id, minWidth: 1280, maxWidth: 1280, minHeight: 720, maxHeight: 720, }, }, }); const video = document.querySelector("video"); video.srcObject = stream; video.onloadedmetadata = (e) => video.play(); } ``` -------------------------------- ### Creating a fullscreen transparent window Source: https://www.u-tools.cn/docs/developer/utools-api/window.html Example of creating a fullscreen, transparent, always-on-top window, useful for screen effects or capturing. ```javascript // 创建全屏透明置顶窗口,可用于做一些屏幕特效或拖动区域截取屏幕等功能 function createFullScreenTransparentWindow () { const cursorPoint = window.utools.getCursorScreenPoint() const currentDisplay = window.utools.getDisplayNearestPoint(cursorPoint) const displayBounds = currentDisplay.bounds const fullscreenable = window.utools.isWindows() const regionWindow = window.utools.createBrowserWindow('foo.html?params=', { show: true, x: displayBounds.x, y: displayBounds.y, width: displayBounds.width, height: displayBounds.height, backgroundColor: '#00000000', // 如果要接收鼠标事件请设置为 'rgba(255,255,255,0.01)', thickFrame: false, resizable: false, fullscreenable, fullscreen: fullscreenable, minimizable: false, maximizable: false, movable: false, autoHideMenuBar: true, frame: false, transparent: true, skipTaskbar: true, enableLargerThanScreen: true, alwaysOnTop: true, roundedCorners: false, hasShadow: false, webPreferences: { preload: 'foo_preload.js' } }) try { regionWindow.setAlwaysOnTop(true, 'screen-saver') } catch {} } ``` -------------------------------- ### Get File Icon Source: https://www.u-tools.cn/docs/developer/api-reference/utools/system.html Examples of retrieving system icons for file extensions, folders, or specific files. ```javascript // System icon for .txt file extension const txtIcon = utools.getFileIcon(".txt"); // System icon for a folder const folderIcon = utools.getFileIcon("folder"); // Icon for a WeChat shortcut file const folderIcon = utools.getFileIcon("C:\\Users\\Public\\Desktop\\微信.lnk"); ``` -------------------------------- ### Dynamic Registration Example (Discouraged) Source: https://www.u-tools.cn/docs/developer/utools-api/tools.html Example of dynamic tool registration, which is discouraged. ```javascript if (xxx) { utools.registerTool(...) } ``` -------------------------------- ### Get User Basic Information - Signature Generation (PHP) Source: https://www.u-tools.cn/docs/developer/api-reference/server.html PHP code example for generating the signature required for API requests. ```php $params = [ "plugin_id" => "zueadppw", // 可在开发者插件应用中获得 "access_token" => "user access_token 32位", "timestamp" => "1624329435", ]; // 1. 按照键名对数组进行升序排序 ksort($params); // 2. 生成 URL-encode 之后的请求字符串 $str = http_build_query($params); // 3. 使用 HMAC 方法生成带有密钥的哈希值 $secret = "your secret 32位"; // secret 在开发者插件应用中通过重置获取 $sign = hash_hmac("sha256", $str, $secret); ``` -------------------------------- ### HTTP POST Request Example Source: https://www.u-tools.cn/docs/developer/api-reference/server.html This shows the HTTP method and content type for the callback request. ```http POST /<*api_path> Content-Type: application/json ``` -------------------------------- ### Get User Basic Information - Signature Generation (Node.js) Source: https://www.u-tools.cn/docs/developer/api-reference/server.html Node.js code example for generating the signature required for API requests. ```js const crypto = require("crypto"); const params = { plugin_id: "zueadppw", // 可在开发者插件应用中获得 access_token: "user access_token 32位", timestamp: "1624329435", }; // 1. 按照键名对数组进行升序排序 const keys = Object.keys(params).sort(); const sortedParams = keys.reduce((acc, key) => { acc[key] = params[key]; return acc; }, {}); // 2. 生成 URL-encode 之后的请求字符串 const str = new URLSearchParams(sortedParams).toString(); // 3. 使用 HMAC 方法生成带有密钥的哈希值 const secret = "your secret 32位"; // secret 在开发者插件应用中通过重置获取 const sign = crypto.createHmac("sha256", secret).update(str).digest("hex"); ``` -------------------------------- ### Webpack Dev Server Script Source: https://www.u-tools.cn/docs/developer/basic/debug-plugin.html Script in package.json to start the webpack-dev-server. ```json //package.json script "scripts": { "serve": "webpack serve", } ``` -------------------------------- ### Simulate Mouse Move Source: https://www.u-tools.cn/docs/developer/api-reference/utools/simulate.html Example of simulating mouse movement to a specified position. ```javascript // Move the mouse to the top-left corner of the screen utools.simulateMouseMove(50, 50); ``` -------------------------------- ### Create Goods Interface - Response Data Source: https://www.u-tools.cn/docs/developer/api-reference/server.html Example JSON response when creating a good. ```json { "message": "ZyxrbSpWBH360pSWG0ueYI3rKSWXMcic" } ``` -------------------------------- ### Importing Custom Modules Source: https://www.u-tools.cn/docs/developer/information/preload-js/nodejs.html Example of importing a custom module ('writeText.js') in preload.js. ```javascript const writeText = require("./libs/writeText.js"); window.services = { writeText, }; ``` ```javascript const fs = require("fs"); const path = require("path"); module.exports = function writeText(text, filePath) { const dir = path.dirname(filePath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); fs.writeFileSync(filePath, text); return true; } return false; }; ``` -------------------------------- ### Get User Basic Information - Making the Request (cURL) Source: https://www.u-tools.cn/docs/developer/api-reference/server.html cURL command to make the GET /baseinfo API request. ```bash curl --location --request GET 'https://open.u-tools.cn/baseinfo' \ --header 'Content-Type: application/json' \ --data-raw '{ "plugin_id": "zueadppw", // 可在开发者插件应用中获得 "access_token": "user access_token 32位", "timestamp": "1624329435", "sign": "xxx" }' ``` -------------------------------- ### Example: Creating a standalone window with preload script Source: https://www.u-tools.cn/docs/developer/utools-api/window.html Demonstrates how to create a new browser window, set its properties, and handle callbacks. ```javascript const win = utools.createBrowserWindow( "test.html", { show: false, title: "测试窗口", webPreferences: { preload: "test_preload.js", }, }, () => { // 显示 win.show(); // 置顶 win.setAlwaysOnTop(true); // 窗口全屏 win.setFullScreen(true); // 向子窗口发送消息 win.webContents.send("ping", "test"); // 执行脚本 win.webContents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())').then((result) => { console.log(result); // Will be the JSON object from the fetch call }); } ); ``` -------------------------------- ### Show System Notification Source: https://www.u-tools.cn/docs/developer/api-reference/utools/system.html Example of how to display a system notification with a message. ```javascript utools.showNotification("hello test"); ``` -------------------------------- ### getItem Example Source: https://www.u-tools.cn/docs/developer/api-reference/db/db-storage.html Retrieves a key-value pair. ```javascript const value = utools.dbStorage.getItem("key"); console.log(value); ``` -------------------------------- ### Progress Feedback Example Source: https://www.u-tools.cn/docs/developer/utools-api/tools.html Illustrates how to use ctx.sendProgress to report task progress. ```javascript ctx.sendProgress?.({ progress, total, message }) ``` -------------------------------- ### Importing Third-Party Modules from Source Source: https://www.u-tools.cn/docs/developer/information/preload-js/nodejs.html Example of cloning a module from GitHub (e.g., 'nodemailer') and importing it in preload.js. ```bash git clone https://github.com/nodemailer/nodemailer.git ``` ```javascript const nodemailer = require("./nodemailer"); const _setImmediate = setImmediate; process.once("loaded", function () { global.setImmediate = _setImmediate; }); const sendMail = () => { let transporter = require("./nodemailer").createTransport({ host: "smtp.qq.com", port: 465, secure: true, auth: { user: "aaa@qq.com", pass: "xxx", }, }); let mailOptions = { from: "aaa@qq.com", to: "bbb@gmail.com", subject: "Sending Email using Node.js", text: "That was easy!", }; transporter.sendMail(mailOptions, function (error, info) { if (error) { console.log(error); } else { console.log("Email sent: " + info.response); } }); }; window.services = { sendMail: () => { return sendMail(); }, }; ``` -------------------------------- ### Check Development Environment Source: https://www.u-tools.cn/docs/developer/api-reference/utools/system.html Example of checking if the plugin is running in a development environment. ```javascript if (utools.isDev()) { console.log("Plugin development environment"); } ``` -------------------------------- ### Screenshot (Capture Entire Screen) Source: https://www.u-tools.cn/docs/developer/utools-api/screen.html Example code for capturing a screenshot of the entire screen. ```js async function captureScreen() { const sources = await utools.desktopCaptureSources({ types: ['screen'] }); // 获取第一个屏幕(通常是主屏) const screenSource = sources[0]; // 使用 MediaStream API 获取视频流 const stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: { mandatory: { chromeMediaSource: 'desktop', chromeMediaSourceId: screenSource.id, } } }); // 创建一个