Browse Source

优化完善rtc

dev-2.0
王子贤 1 month ago
parent
commit
894c7b52ca
1 changed files with 44 additions and 3 deletions
  1. 47
      lib/rtc/rtc_manager.dart

47
lib/rtc/rtc_manager.dart

@ -479,6 +479,7 @@ class RTCManager {
}
await _engine!.enableVideo();
print('视频已启用');
}
///
@ -609,20 +610,20 @@ class RTCManager {
);
print('正在加入频道:$channelId,UID:$uid,类型:$rtcType');
if (role == ClientRoleType.clientRoleBroadcaster) {
await _engine?.enableFaceDetection(true);
await _engine?.enableContentInspect(
enabled: true,
config: ContentInspectConfig(
modules: [
ContentInspectModule(
type: ContentInspectType.contentInspectImageModeration,
interval: 10
type: ContentInspectType.contentInspectSupervision,
interval: 15
)
],
moduleCount: 1
)
);
await _engine?.enableFaceDetection(true);
}
}
@ -643,6 +644,19 @@ class RTCManager {
await _engine!.leaveChannel();
_currentUid = null;
print('已离开频道');
await _engine?.enableContentInspect(
enabled: false,
config: ContentInspectConfig(
modules: [
ContentInspectModule(
type: ContentInspectType.contentInspectSupervision,
interval: 15
)
],
moduleCount: 1
)
);
}
///
@ -760,6 +774,19 @@ class RTCManager {
await _engine?.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
await _engine?.muteLocalAudioStream(false);
await _engine?.muteLocalVideoStream(false);
await _engine?.enableContentInspect(
enabled: true,
config: ContentInspectConfig(
modules: [
ContentInspectModule(
type: ContentInspectType.contentInspectSupervision,
interval: 15
)
],
moduleCount: 1
)
);
await RTMManager.instance.publishChannelMessage(
channelName: _currentChannelId ?? '',
message: json.encode({
@ -770,6 +797,7 @@ class RTCManager {
: 'female_audience',
}),
);
print("发布视频");
}
///
@ -792,6 +820,19 @@ class RTCManager {
await _engine?.setClientRole(role: ClientRoleType.clientRoleAudience);
await _engine?.muteLocalAudioStream(true);
await _engine?.muteLocalVideoStream(true);
await _engine?.enableContentInspect(
enabled: false,
config: ContentInspectConfig(
modules: [
ContentInspectModule(
type: ContentInspectType.contentInspectSupervision,
interval: 15
)
],
moduleCount: 1
)
);
await RTMManager.instance.publishChannelMessage(
channelName: _currentChannelId ?? '',
message: json.encode({

Loading…
Cancel
Save