setClientRole method
- ClientRole role,
- [ClientRoleOptions options]
设置直播场景下的用户角色。
在加入频道前,用户需要通过本方法设置观众(默认)或主播模式。在加入频道后,用户可以通过本方法切换用户模式。
直播场景下,如果你在加入频道后调用该方法切换用户角色,调用成功后,本地会触发 RtcEngineEventHandler.clientRoleChanged 回调;
远端会触发 RtcEngineEventHandler.userJoined 或 RtcEngineEventHandler.userOffline (BecomeAudience
) 回调。
Parameter role
用户角色。详见 ClientRole。
Parameter options
用户具体设置,包含用户级别,详见 ClientRoleOptions。
Implementation
@override
Future<void> setClientRole(ClientRole role, [ClientRoleOptions options]) {
return _invokeMethod('setClientRole', {
'role': ClientRoleConverter(role).value(),
'options': options?.toJson()
});
}