# 人像锁定 (/zh-CN/api-reference/rtc/cpp-all-platforms/video/video-prenpro/center-stage)
> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).
## enableCameraCenterStage [#enablecameracenterstage]
启用或关闭人像锁定功能。
```cpp
virtual int enableCameraCenterStage(bool enabled) = 0;
```
默认情况下,人像锁定功能处于关闭状态。你需要调用此方法来开启该功能。如需关闭该功能,请再次调用该方法并将 `enabled` 设置为 false。
:::note
注: 该方法仅适用于 iOS 和 macOS 平台。
由于该功能对设备性能要求较高,建议在以下设备或性能更高的设备上使用:
- iPad:
- 12.9 英寸 iPad Pro(第 5 代)
- 11 英寸 iPad Pro(第 3 代)
- iPad(第 9 代)
- iPad mini(第 6 代)
- iPad Air(第 5 代)
- 2020 款 M1 芯片 13 英寸 MacBook Pro + iPhone 11(将 iPhone 用作 MacBook 的外部摄像头)
声网建议在启用该功能前调用 [isCameraCenterStageSupported](/zh-CN/api-reference/rtc/cpp-all-platforms/video/video-prenpro/center-stage#api_irtcengine_iscameracenterstagesupported) 方法,检查当前设备是否支持人像锁定功能。
:::
### 适用场景 [#适用场景]
人像锁定功能适用于在线会议、演出、在线教育等场景。主持人可以使用该功能确保无论是否移动,始终处于画面中央,从而获得更好的展示效果。
### 调用时机 [#调用时机]
必须在成功启用摄像头之后调用此方法,即 SDK 触发 [onLocalVideoStateChanged](/zh-CN/api-reference/rtc/cpp-all-platforms/video/video-basic#callback_irtcengineeventhandler_onlocalvideostatechanged) 回调并返回本地视频状态为 `LOCAL_VIDEO_STREAM_STATE_CAPTURING`(1)之后。
### 参数 [#参数]
是否启用人像锁定功能:
- true:启用人像锁定功能。
- false:关闭人像锁定功能。
### 返回值 [#返回值]
- 0:方法调用成功。
- < 0:方法调用失败。详见[错误码](/zh-CN/api-reference/rtc/error-code)了解详情和解决建议。
### 所属接口类 [#所属接口类]
- [IRtcEngine](/zh-CN/api-reference/rtc/cpp-all-platforms/rtc-interface-class#class_irtcengine)
## isCameraCenterStageSupported [#iscameracenterstagesupported]
检查当前摄像头是否支持人像锁定功能。
```cpp
virtual bool isCameraCenterStageSupported() = 0;
```
建议在调用 [enableCameraCenterStage](/zh-CN/api-reference/rtc/cpp-all-platforms/video/video-prenpro/center-stage#api_irtcengine_enablecameracenterstage) 启用人像锁定功能前,先调用该方法确认当前设备是否支持此功能。你必须在摄像头成功启用后调用该方法,即 SDK 触发 [onLocalVideoStateChanged](/zh-CN/api-reference/rtc/cpp-all-platforms/video/video-basic#callback_irtcengineeventhandler_onlocalvideostatechanged) 回调并返回本地视频状态为 `LOCAL_VIDEO_STREAM_STATE_CAPTURING`(1)之后。
:::note
注: 该方法仅适用于 iOS 和 macOS 平台。
:::
### 调用时机 [#调用时机-1]
必须在摄像头成功启用后调用,即 SDK 触发 [onLocalVideoStateChanged](/zh-CN/api-reference/rtc/cpp-all-platforms/video/video-basic#callback_irtcengineeventhandler_onlocalvideostatechanged) 回调并返回本地视频状态为 `LOCAL_VIDEO_STREAM_STATE_CAPTURING`(1)之后。
### 返回值 [#返回值-1]
- true:当前摄像头支持人像锁定功能。
- false:当前摄像头不支持人像锁定功能。
### 所属接口类 [#所属接口类-1]
- [IRtcEngine](/zh-CN/api-reference/rtc/cpp-all-platforms/rtc-interface-class#class_irtcengine)