- Documentation
- Screen Sharing
- Quick Starts
- Integration
Integration
1 Prepare the Environment
Please ensure that the development environment meets the following technical requirements:
- Operating system Windows 7 or above / macOS 10.10 or above.
- The computer is connected to the Internet and has external devices that support audio and video such as microphones and cameras.
- Install Node.js, it is recommended to use the long-term support version shown on the homepage of its official website.
zego-express-engine-electron-plugin-screen-capture
as a plug-in of zego-express-engine-electron
, both are published on the npm repository at the same time, and need to be combined to complete the screen sharing function. Please integrate the dependent zego-express-engine-electron
first. For related documents, please refer to the SDK Integration Guidelines of zego-express-engine-electron
.
2 Integrated SDK
2.1 Install SDK
In the corresponding project directory, execute the following command in the command line to install the latest version of the SDK.
npm install zego-express-engine-electron-plugin-screen-capture
When you execute npm install
to install the SDK, if the download of the npm official website image is slow, you can switch to the domestic image.
2.2 Introducing SDK
Use the following code to introduce the SDK into the project.
const zgScreenCapture = window.require('zego-express-engine-electron-plugin-screen-capture').ZegoExpressPluginScreenCaptureInstance;
2.3 Operation before Collection
After the SDK is introduced, developers can call other interfaces provided by the SDK between initialization and de-initialization to achieve more collection functions, such as Sharing Selected Screen, Sharing Selected Window and Window Thumbnails. It is recommended that the developer set the log configuration and monitor the error callback after initialization, so that the problem can be discovered in time when the collection error occurs.
const zgScreenCaptureLogLevel = window.require('zego-express-engine-electron-plugin-screen-capture').ZegoExpressPluginScreenCaptureLogLevel;
// Initialize
zgScreenCapture.init();
// Set the log configuration (the log file is generated in the project root directory by default and named with zegoscreencaplog as the prefix)
zgScreenCapture.setLogConfig(logLevel=zgScreenCaptureLogLevel.LogLevelDebug, logPath='.');
// Monitor the error callback during the collection process
zgScreenCapture.on("onScreenCaptureError", param => {
console.log("onScreenCaptureError: errorCode=", param.errorCode);
});
// after initialization/deinitialization
// Call other SDK interfaces to achieve more functions
// xxx
// Deinitialization
zgScreenCapture.uninit();