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

Loading…
Cancel
Save