setClientRole abstract method

Future<void> setClientRole({
  1. required ClientRoleType role,
  2. ClientRoleOptions? options,
})

Set the user role and the audience latency level in a live streaming scenario.

By default,the SDK sets the user role as audience. You can call this method to set the user role as host. The user role (roles) determines the users' permissions at the SDK level, including whether they can publish audio and video streams in a channel.

  • role The user role. See ClientRoleType. If you set the user role as an audience member, you cannot publish audio and video streams in the channel. If you want to publish media streams in a channel during live streaming, ensure you set the user role as broadcaster.
  • options The detailed options of a user, including the user level. See ClientRoleOptions.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.

Implementation

Future<void> setClientRole(
    {required ClientRoleType role, ClientRoleOptions? options});