-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathapi_irtcengine_enablevirtualbackground.dita
More file actions
114 lines (114 loc) · 7.81 KB
/
Copy pathapi_irtcengine_enablevirtualbackground.dita
File metadata and controls
114 lines (114 loc) · 7.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="api_irtcengine_enablevirtualbackground">
<title><ph keyref="enableVirtualBackground"/></title>
<shortdesc id="short"><ph id="shortdesc">开启/关闭虚拟背景。</ph></shortdesc>
<prolog>
<metadata>
<keywords>
<indexterm keyref="enableVirtualBackground"/>
</keywords>
</metadata>
</prolog>
<refbody>
<section id="prototype">
<p outputclass="codeblock">
<codeblock props="android" outputclass="language-java">public abstract int enableVirtualBackground(
boolean enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty);
</codeblock>
<codeblock props="hmos" outputclass="language-arkts"></codeblock>
<codeblock props="ios mac" outputclass="language-objectivec">- (int)enableVirtualBackground:(BOOL)enable backData:(AgoraVirtualBackgroundSource* _Nullable)backData segData:(AgoraSegmentationProperty* _Nullable)segData NS_SWIFT_NAME(enableVirtualBackground(_:backData:segData:));</codeblock>
<codeblock props="cpp unreal">virtual int enableVirtualBackground(bool enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, agora::media::MEDIA_SOURCE_TYPE type = agora::media::PRIMARY_CAMERA_SOURCE) = 0;
</codeblock>
<codeblock props="bp" outputclass="language-cpp">UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableVirtualBackground(bool enabled, FVirtualBackgroundSource backgroundSource, FSegmentationProperty segproperty, EMEDIA_SOURCE_TYPE type);</codeblock>
<codeblock props="electron" outputclass="language-typescript">abstract enableVirtualBackground(
enabled: boolean,
backgroundSource: VirtualBackgroundSource,
segproperty: SegmentationProperty,
type?: MediaSourceType
): number;</codeblock>
<codeblock props="unity cs" outputclass="language-csharp">public abstract int EnableVirtualBackground(bool enabled, VirtualBackgroundSource backgroundSource, SegmentationProperty segproperty, MEDIA_SOURCE_TYPE type = MEDIA_SOURCE_TYPE.PRIMARY_CAMERA_SOURCE);</codeblock>
<codeblock props="rn" outputclass="language-typescript">abstract enableVirtualBackground(
enabled: boolean,
backgroundSource: VirtualBackgroundSource,
segproperty: SegmentationProperty,
type?: MediaSourceType
): number;</codeblock>
<codeblock props="flutter" outputclass="language-dart">Future<void> enableVirtualBackground(
{required bool enabled,
required VirtualBackgroundSource backgroundSource,
required SegmentationProperty segproperty,
MediaSourceType type = MediaSourceType.primaryCameraSource});</codeblock>
<codeblock props="reserve" outputclass="language-cpp"></codeblock></p>
</section>
<section id="detailed_desc">
<title>详情</title>
<p>虚拟背景功能支持将本地用户原来的背景替换为静态图片、动态视频、将背景虚化,或者将人像与背景分割以实现人像画中画。成功开启虚拟背景功能后,频道内所有用户都能看到自定义的背景。</p>
<p>请在 <xref keyref="enableVideo"/> 或 <xref keyref="startPreview2"/> 之后调用该方法。</p>
<note type="attention" id="hardware_req">
<ul>
<li>使用视频作为虚拟背景会导致内存占用持续增加,可能会导致 App 出现闪退等问题,因此在使用时请尽量降低视频的分辨率和帧率。</li>
<li>该功能对设备性能要求较高,调用该方法时 SDK 会自动对当前设备能力进行检查。建议你在搭载如下芯片的设备上使用:
<ul>
<li props="android unity cpp unreal bp rn flutter cs">骁龙 700 系列 750G 及以上</li>
<li props="android unity cpp unreal bp rn flutter cs">骁龙 800 系列 835 及以上</li>
<li props="android unity cpp unreal bp rn flutter cs">天玑 700 系列 720 及以上</li>
<li props="android unity cpp unreal bp rn flutter cs">麒麟 800 系列 810 及以上</li>
<li props="android unity cpp unreal bp rn flutter cs">麒麟 900 系列 980 及以上</li>
<li props="mac cpp unreal bp unity electron cs">CPU 为 i5 及更好的设备</li>
<li props="ios cpp unreal bp unity rn flutter cs">搭载 A9 及以上芯片的如下设备:
<ul>
<li>iPhone 6S 及以上</li>
<li>iPad Air 第三代及以上</li>
<li>iPad 第五代及以上</li>
<li>iPad Pro 第一代及以上</li>
<li>iPad mini 第五代及以上</li>
</ul></li>
</ul></li>
<li>建议你在满足如下条件的场景中使用该功能:
<ul>
<li>使用高清摄像设备、摄像环境光照均匀。</li>
<li>摄像画面中,物件较少,用户的人像为半身人像且基本无遮挡,背景色较单一且与用户着装颜色不同。</li>
</ul></li>
<li>该方法依赖于虚拟背景动态库 <codeph><ph keyref="segmentation"/></codeph>,如果删除该动态库会导致无法正常开启该功能。</li>
</ul></note> </section>
<section id="parameters">
<title>参数</title>
<parml>
<plentry id="enable">
<pt props="cpp unreal bp android unity flutter rn electron cs">enabled</pt>
<pt props="ios mac">enable</pt>
<pd>是否开启虚拟背景:
<ul>
<li><codeph><ph keyref="true"/></codeph>: 开启虚拟背景。</li>
<li><codeph><ph keyref="false"/></codeph>: 关闭虚拟背景。</li>
</ul></pd>
</plentry>
<plentry id="source">
<pt props="cpp unreal bp android unity flutter rn electron cs">backgroundSource</pt>
<pt props="mac ios">backData</pt>
<pd>自定义的背景。详见 <xref keyref="VirtualBackgroundSource"/>。为将自定义背景图的分辨率与 SDK 的视频采集分辨率适配,SDK 会在保证自定义背景图不变形的前提下,对自定义背景图进行缩放和裁剪。</pd>
</plentry>
<plentry id="seg">
<pt props="android cpp unreal bp unity electron rn flutter cs">segproperty</pt>
<pt props="ios mac">segData</pt>
<pd>背景图像的处理属性。详见 <xref keyref="SegmentationProperty"/>。</pd>
</plentry>
<plentry conkeyref="setLowlightEnhanceOptions/type" props="cpp unreal bp rn unity electron flutter cs">
<pt/>
<pd/>
</plentry>
</parml> </section>
<section id="return_values">
<title><ph keyref="return-section-title"/></title>
<p props="flutter">方法成功调用时,无返回值;方法调用失败时,会抛出 <xref keyref="AgoraRtcException"/> 异常,你需要捕获异常并进行处理。<ph props="cn">详见<xref keyref="error-code-link"/>了解详情和解决建议。</ph></p>
<ul props="native unreal bp electron unity rn cs">
<li>0: 方法调用成功。</li>
<li>< 0: 方法调用失败。<ph props="cn">详见<xref keyref="error-code-link"/>了解详情和解决建议。</ph>
<ul>
<li>-4:设备能力不满足虚拟背景的使用要求,建议更换性能更高的设备。</li>
</ul></li>
</ul> </section>
</refbody>
</reference>