提交工单
咨询集成、功能及报价等问题
The screen sharing function refers to selecting a certain screen as the collection target and performing data collection, and pushing the collected data out. This article mainly describes how to perform screen collection.
Calling the enumScreenList
interface will return the screen array screenList
to obtain the screen list information.
let screenList = zgScreenCapture.enumScreenList()
console.log("screenList: ", screenList)
The prototype of each screen object is as follows.
IZegoExpressPluginScreenCaptureScreenItem {
/**
* identification for the screen
*/
screenID: any,
/**
* is the primary screen
*/
isPrimary: boolean
}
Call the setTargetScreen
interface to pass in the screenID
of a certain screen to complete the collection target setting.
// If you select the first screen
let theTargetScreen = screenList[0]
// Pass in the screenID of the selected screen to setTargetScreen
zgScreenCapture.setTargetScreen(theTargetScreen.screenID);
Call the startCapture
interface to start screen capture. Before starting the acquisition, you can set the screen acquisition frame rate, whether to capture the cursor and other information at the same time.
// Set the acquisition frame rate,
// The default acquisition frame rate is 5fps, it is recommended to keep the frame rate low
zgScreenCapture.setFPS(5);
// Set whether to capture the cursor at the same time
zgScreenCapture.setCursorVisible(visible=true);
// Set whether to display the click animation while capturing the sharing screen
zgScreenCapture.enableClickAnimation(enable=false);
// start collection
zgScreenCapture.startCapture();