

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 設定 Amazon Chime SDK 的VideoFxProcessor物件
<a name="configure-videofxprocessor"></a>

下表列出您可以設定的`VideoFxProcessor`屬性。下表的範例顯示典型的執行時間組態。

**背景模糊**  
背景模糊具有下列屬性：


| 屬性 | Type | 說明 | 
| --- | --- | --- | 
| `isEnabled` | `boolean` | 當 時`true`，篩選條件會模糊背景。 | 
| `strength` | `string` | 決定模糊的程度。有效值：`low` \| `medium` \| `high`. | 

**背景替換**  
背景替換採用下列參數：


| 屬性 | Type | 說明 | 
| --- | --- | --- | 
| `isEnabled` | `boolean` | 當 時`true`，篩選條件會取代背景。 | 
| `backgroundImageURL` | `string` | 背景映像的 URL。篩選條件會將影像動態調整為目前畫面的維度。您可以使用字串，例如 `https://...`或資料 URL，例如 `data:image/jpeg;base64`。 | 
| `defaultColor` | `string` | 十六進位顏色字串，例如 `000000`或 `FFFFFF`，或字串，例如 `black`或 `white`。如果您未指定映像 URL，處理器會使用 `defaultColor`做為背景。如果您未指定處理器，`defaultColor`則預設為黑色。 | 

**在執行時間變更組態**  
您可以使用 `videoFxProcessor.setEffectConfig` 參數在執行時間變更`VideoFxProcessor`組態。下列範例示範如何啟用背景取代和停用背景模糊。

**注意**  
您一次只能指定一種背景替換類型。指定 `backgroundImageURL`或 的值`defaultColor`，但不能同時指定兩者。

```
videoFxConfig.backgroundBlur.isEnabled = false;
videoFxConfig.backgroundReplacement.isEnabled = true;
try {
  await videoFxProcessor.setEffectConfig(videoFxConfig);
} catch(error) {
  logger.error(error.toString())
}
```

如果 `setEffectConfig`擲回例外狀況，先前的組態仍然有效。 在類似導致`setEffectConfig`擲回例外狀況的條件下`VideoFxProcessor.create`擲回例外狀況。

下列範例示範如何在影片執行時變更背景影像。

```
videoFxConfig.backgroundReplacement.backgroundImageURL = "https://{{my-domain.com}}/{{my-other-image.jpg}}";
try {
  await videoFxProcessor.setEffectConfig(videoFxConfig);
} catch(error) {
  logger.error(error.toString())
}
```