TUIVideoEffectPluginManager
is a video effect plugin manager that supports integration with third-party libraries to achieve personalized processing of video data, such as connecting to third-party beauty libraries.// npmnpm i @tencentcloud/tuiroom-engine-electron@2.4.0-alpha.3 --save// pnpmpnpm i @tencentcloud/tuiroom-engine-electron@2.4.0-alpha.3 --save// yarnyarn add @tencentcloud/tuiroom-engine-electron@2.4.0-alpha.3
import TUIRoomEngine, {TUIVideoEffectPluginManager,TUIVideoEffectPlugin,TUIVideoPixelFormat} from '@tencentcloud/tuiroom-engine-electron';const videoEffectPluginManager: TUIVideoEffectPluginManager = TUIRoomEngine.getVideoEffectPluginManager();videoEffectPluginManager.setVideoPluginFormat(TUIVideoPixelFormat.kVideoPixelFormat_I420);videoEffectPluginManager.setCallback((pluginId: string, errorCode: number, errorMessage: string) => {console.log(`plugin event - pluginId : ${pluginId}, errorCode : ${errorCode}, errorMessage : ${errorMessage}`);});const cameraId = ''; // Camera ID. TUIDeviceManager.getDevicesList() can get all the camera connected to your computer.const pluginId = `${cameraId}-${new Date().getTime()}`; // ID can any string but unique between multiple pluginsconst plugin: TUIVideoEffectPlugin | null = videoEffectPluginManager.addVideoPlugin({pluginId: pluginId,deviceId: cameraId,path: '', // Path to the customer-developed video data preprocessing library file});if (plugin) {plugin.enable(true);plugin.setParameter('{}'); // JSON string}
Method | Description |
Set the basic parameters of the video effect plugin | |
Add a video effect plugin | |
Remove a video effect plugin | |
Set the callback function for the video effect plugin |
Attribute | Type | Description |
id | string | Plugin ID |
deviceId | string | Camera device ID |
Method | Description |
Enable video effect plugin | |
Set video effect parameter |
Enum | Description |
Video pixel format |
import TUIRoomEngine, {TUIVideoEffectPluginManager,TUIVideoPixelFormat} from '@tencentcloud/tuiroom-engine-electron';const videoEffectPluginManager: TUIVideoEffectPluginManager = TUIRoomEngine.getVideoEffectPluginManager();videoEffectPluginManager.setVideoPluginFormat(TUIVideoPixelFormat.kVideoPixelFormat_I420);
Parameter | Type | Validation | Default value | Description |
pixelFormat | - | - | Video pixel format |
void
import TUIRoomEngine, {TUIVideoEffectPluginManager,TUIVideoEffectPlugin,TUIVideoPixelFormat} from '@tencentcloud/tuiroom-engine-electron';const videoEffectPluginManager: TUIVideoEffectPluginManager = TUIRoomEngine.getVideoEffectPluginManager();videoEffectPluginManager.setVideoPluginFormat(TUIVideoPixelFormat.kVideoPixelFormat_I420);videoEffectPluginManager.setCallback((pluginId: string, errorCode: number, errorMessage: string) => {console.log(`plugin event, pluginId : ${pluginId}, errorCode : ${errorCode}, errorMessage : ${errorMessage}`);});const cameraId = ''; // Camera ID. TUIDeviceManager.getDevicesList() can get all the camera connected to your computer.const pluginId = `${cameraId}-${new Date().getTime()}`; // ID can any string but unique between multiple pluginsconst plugin: TUIVideoEffectPlugin | null = videoEffectPluginManager.addVideoPlugin({pluginId: pluginId,deviceId: cameraId,path: '', // Path to the customer-developed video data preprocessing library file});if (plugin) {plugin.enable(true);plugin.setParameter('{}'); // JSON string}
Parameter | Type | Validation | Default value | Description |
options | Record<string, string> | - | - | Video effect plugin parameters |
options.pluginId | string | - | - | Video effect plugin ID |
options.deviceId | string | - | - | Camera device ID |
options.path | string | - | - | Path to the video effect plugin dynamic library, dll file on Windows platform, dylib file on Mac platform |
TUIVideoEffectPlugin
|null
import TUIRoomEngine, {TUIVideoEffectPluginManager,TUIVideoEffectPlugin} from '@tencentcloud/tuiroom-engine-electron';const videoEffectPluginManager: TUIVideoEffectPluginManager = TUIRoomEngine.getVideoEffectPluginManager();const plugin: TUIVideoEffectPlugin;if (plugin) {videoEffectPluginManager.removeVideoPlugin(plugin.id, plugin.deviceId);}
Parameter | Type | Validation | Default value | Description |
pluginId | string | - | - | Plugin ID |
deviceId | string | - | - | Camera device ID |
void
import TUIRoomEngine, {TUIVideoEffectPluginManager,} from '@tencentcloud/tuiroom-engine-electron';const videoEffectPluginManager: TUIVideoEffectPluginManager = TUIRoomEngine.getVideoEffectPluginManager();videoEffectPluginManager.setCallback((pluginId: string, errorCode: number, errorMessage: string) => {console.log(`plugin event, pluginId : ${pluginId}, errorCode : ${errorCode}, errorMessage : ${errorMessage}`);});
Parameter | Type | Validation | Default value | Description |
callback | (pluginId: string, errorCode: number, errorMessage: string) => void | - | - | Callback function |
void
Parameter | Type | Validation | Default value | Description |
flag | boolean | - | - | Whether to enable |
void
import TUIRoomEngine, {TUIVideoEffectPluginManager,TUIVideoEffectPlugin,TUIVideoPixelFormat} from '@tencentcloud/tuiroom-engine-electron';const videoEffectPluginManager: TUIVideoEffectPluginManager = TUIRoomEngine.getVideoEffectPluginManager();videoEffectPluginManager.setVideoPluginFormat(TUIVideoPixelFormat.kVideoPixelFormat_I420);videoEffectPluginManager.setCallback((pluginId: string, errorCode: number, errorMessage: string) => {console.log(`plugin event, pluginId : ${pluginId}, errorCode : ${errorCode}, errorMessage : ${errorMessage}`);});const cameraId = ''; // Camera ID. TUIDeviceManager.getDevicesList() can get all the camera connected to your computer.const pluginId = `${cameraId}-${new Date().getTime()}`; // ID can any string but unique between multiple pluginsconst plugin: TUIVideoEffectPlugin | null = videoEffectPluginManager.addVideoPlugin({pluginId: pluginId,deviceId: cameraId,path: '', // Path to the customer-developed video data preprocessing library file});if (plugin) {plugin.enable(true);plugin.setParameter('{}'); // JSON string}
Parameter | Type | Validation | Default value | Description |
param | string | Supports JSON.parse() deserialization | - | JSON string, refer to the dynamic library passed to the video effect processing |
void
Enumeration item | Type | Description |
TUIVideoPixelFormat_I420 | number | I420 |
TUIVideoPixelFormat_BGRA32 | number | BGRA32 |
TUIVideoPixelFormat_RGBA32 | number | RGBA32 |
Was this page helpful?