setLocalMediaPriority method Null safety
Sets the priority of media streams from a local user.
If a user has a high priority, the media stream from the user also has a high priority. In unreliable network connections, the SDK guarantees the quality of the media stream from users with a high priority.
Call this method before you join a room. An RTC room has only one user of high priority. We recommend that only one user in a room call the setLocalMediaPriority method to set the local media stream to high priority. Otherwise, you need to enable the preemptive mode to ensure the high priority of the local media stream.
priority specifies the priority of the local media stream. The default value is NERtcMediaPriority.normal. For more information, see NERtcMediaPriority.
isPreemptive specifies whether to enable the preemptive mode. /// If the preemptive mode is enabled, the local media stream preempts the high priority over other users. The priority of the media stream whose high priority is deprived becomes normal. After the user who preempts the priority leaves the room, other users still keep the normal priority.
If the preemptive mode is disabled, and a user in the room has a high priority, then, the high priority setting of the local client remains invalid and is normal.
Implementation
Future<int> setLocalMediaPriority(int priority, bool isPreemptive) async {
IntValue reply =
await _api.setLocalMediaPriority(SetLocalMediaPriorityRequest()
..priority = priority
..isPreemptive = isPreemptive);
return reply.value ?? -1;
}