From 894c7b52ca1e81a365371320117a14eb5eb0786a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Fri, 10 Apr 2026 14:13:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=8C=E5=96=84rtc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rtc/rtc_manager.dart | 47 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/lib/rtc/rtc_manager.dart b/lib/rtc/rtc_manager.dart index 551d8f0..a492607 100644 --- a/lib/rtc/rtc_manager.dart +++ b/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({