This commit is contained in:
hrxiang
2022-11-25 17:03:50 +08:00
parent 099cb9849a
commit b8a51374a3
13 changed files with 89 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ class OnSignalingListener {
final Function(RoomCallingInfo info)? onRoomParticipantConnected;
final Function(RoomCallingInfo info)? onRoomParticipantDisconnected;
final Function(MeetingStreamEvent event)? onMeetingStreamChanged;
final Function(CustomSignaling info)? onReceiveCustomSignal;
OnSignalingListener({
this.onInvitationCancelled,
@@ -26,6 +27,7 @@ class OnSignalingListener {
this.onRoomParticipantConnected,
this.onRoomParticipantDisconnected,
this.onMeetingStreamChanged,
this.onReceiveCustomSignal,
});
/// 被邀请者收到:邀请者取消音视频通话
@@ -79,4 +81,8 @@ class OnSignalingListener {
void streamChangedEvent(MeetingStreamEvent event) {
onMeetingStreamChanged?.call(event);
}
void receiveCustomSignal(CustomSignaling info) {
onReceiveCustomSignal?.call(info);
}
}

View File

@@ -254,6 +254,9 @@ class IMManager {
info =
Utils.toObj(data, (map) => MeetingStreamEvent.fromJson(map));
break;
case 'onReceiveCustomSignal':
info = Utils.toObj(data, (map) => CustomSignaling.fromJson(map));
break;
default:
info = Utils.toObj(data, (map) => SignalingInfo.fromJson(map));
break;
@@ -292,6 +295,9 @@ class IMManager {
case 'onStreamChange':
signalingManager.listener.streamChangedEvent(info);
break;
case 'onReceiveCustomSignal':
signalingManager.listener.receiveCustomSignal(info);
break;
}
} else if (call.method == ListenerType.workMomentsListener) {
String type = call.arguments['type'];
@@ -332,6 +338,7 @@ class IMManager {
int logLevel = 6,
String objectStorage = 'cos',
String? encryptionKey,
bool enabledEncryption = false,
String? operationID,
}) {
this._connectListener = listener;
@@ -347,6 +354,7 @@ class IMManager {
"log_level": logLevel,
"object_storage": objectStorage,
"encryption_key": encryptionKey,
"is_need_encryption": enabledEncryption,
"operationID": Utils.checkOperationID(operationID),
},
));

View File

@@ -823,9 +823,9 @@ class MessageManager {
.invokeMethod(
'createImageMessageByURL',
_buildParam({
'sourcePicture': sourcePicture,
'bigPicture': bigPicture,
'snapshotPicture': snapshotPicture,
'sourcePicture': sourcePicture.toJson(),
'bigPicture': bigPicture.toJson(),
'snapshotPicture': snapshotPicture.toJson(),
"operationID": Utils.checkOperationID(operationID),
}),
)
@@ -840,7 +840,7 @@ class MessageManager {
.invokeMethod(
'createSoundMessageByURL',
_buildParam({
'soundElem': soundElem,
'soundElem': soundElem.toJson(),
"operationID": Utils.checkOperationID(operationID),
}),
)
@@ -855,7 +855,7 @@ class MessageManager {
.invokeMethod(
'createVideoMessageByURL',
_buildParam({
'videoElem': videoElem,
'videoElem': videoElem.toJson(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
@@ -869,7 +869,7 @@ class MessageManager {
.invokeMethod(
'createFileMessageByURL',
_buildParam({
'fileElem': fileElem,
'fileElem': fileElem.toJson(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));

View File

@@ -281,6 +281,22 @@ class SignalingManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// 自定义信令
/// [roomID] 会议ID
/// [customInfo] 自定义信令
Future<dynamic> signalingSendCustomSignal({
required String roomID,
required String customInfo,
String? operationID,
}) =>
_channel.invokeMethod(
'signalingSendCustomSignal',
_buildParam({
'roomID': roomID,
'customInfo': customInfo,
'operationID': Utils.checkOperationID(operationID),
}));
static Map _buildParam(Map param) {
param["ManagerName"] = "signalingManager";
return param;

View File

@@ -790,7 +790,8 @@ class AttachedInfoElem {
/// 已读时间
int? hasReadTime;
/// 私聊消息保留时长
/// 阅读时长 s
/// 即从hasReadTime时间算起超过了burnDuration秒触发销毁
int? burnDuration;
/// 离线不发送推送

View File

@@ -224,3 +224,22 @@ class Participant {
return data;
}
}
class CustomSignaling {
String? roomID;
String? customInfo;
CustomSignaling({this.roomID, this.customInfo});
CustomSignaling.fromJson(Map<String, dynamic> json) {
roomID = json['roomID'];
customInfo = json['customInfo'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['roomID'] = roomID;
data['customInfo'] = customInfo;
return data;
}
}