Documentation
ScreenCaptureSDK Screen Sharing
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Screen Sharing
  • Quick Starts
  • Sharing Selected Screen

Sharing Selected Screen

Last updated:2022-03-22 13:06

1 Introduction

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.

2 Collection Call Process

2.1 Get the Screen List

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
}

2.2 Set Collection Target

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);

2.3 Start Collecting

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();
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code