音视频通话

屏幕采集源获取

功能介绍

在开始屏幕共享之前,需要先获取可用的屏幕和窗口采集源列表,供用户选择要共享的屏幕或应用窗口。

1. 获取采集源列表

使用 getScreenCaptureSources 获取屏幕/窗口采集源列表。

const rtcsdk = new RTCSDK();

const thumbSize = { width: 190, height: 108 };
const iconSize = { width: 32, height: 32 };

// types: 1=屏幕 2=窗口 3=屏幕+窗口
const sources = rtcsdk.getScreenCaptureSources(thumbSize, iconSize, 3);
sources.forEach((source) => {
    // source._sourceId - 采集源标识
    // source._sourceName - 采集源名称(屏幕名或窗口标题)
    // source._thumbImage - 缩略图
    // source._type - 0=屏幕 1=窗口
});

相关 API 请参考: