sharedTexture
将共享纹理导入 Electron 并将平台特定的句柄转换为
VideoFrame。支持所有 Web 渲染系统,并且可以在 Electron 进程之间传输。更多信息请阅读 这里。
方法
🌐 Methods
sharedTexture 模块具有以下方法:
🌐 The sharedTexture module has the following methods:
注意: 实验性 API 已标注为实验性,将来可能被移除。
sharedTexture.importSharedTexture(options) 实验性
🌐 sharedTexture.importSharedTexture(options) Experimental
从给定选项导入共享纹理。
🌐 Imports the shared texture from the given options.
此方法仅在主进程中可用。
返回 SharedTextureImported - 导入的共享纹理。
🌐 Returns SharedTextureImported - The imported shared texture.
sharedTexture.sendSharedTexture(options, ...args) 实验性
🌐 sharedTexture.sendSharedTexture(options, ...args) Experimental
...argsany[] - 传递给渲染进程的额外参数。
将导入的共享纹理发送到渲染器进程。在调用此方法之前,必须在渲染器进程中注册接收器。此方法的超时时间为1000毫秒。请在调用此方法之前确保接收器已设置并且渲染器进程处于活动状态。
🌐 Send the imported shared texture to a renderer process. You must register a receiver at renderer process before calling this method. This method has a 1000ms timeout. Ensure the receiver is set and the renderer process is alive before calling this method.
此方法仅在主进程中可用。
返回 Promise<void> - 在传输完成时解析。
🌐 Returns Promise<void> - Resolves when the transfer is complete.
sharedTexture.setSharedTextureReceiver(callback) 实验性
🌐 sharedTexture.setSharedTextureReceiver(callback) Experimental
- 'callback' 函数<Promise<void>> - 接收导入的共享纹理的函数。
receivedSharedTextureData对象 - 来自主进程的数据。importedSharedTextureSharedTextureImported - 导入的共享纹理。
...argsany[] - 从主进程传递的额外参数。
设置回调以接收来自主进程导入的共享纹理。
🌐 Set a callback to receive imported shared textures from the main process.
此方法仅在渲染进程中可用。
属性
🌐 Properties
sharedTexture 模块具有以下属性:
🌐 The sharedTexture module has the following properties:
sharedTexture.subtle 实验性
🌐 sharedTexture.subtle Experimental
一个 SharedTextureSubtle 属性,为高级用户提供与共享纹理交互的细微 API。
🌐 A SharedTextureSubtle property, provides subtle APIs for interacting with shared texture for advanced users.