feat(mobile-next): 迁移 Android 一对一语音通话薄适配与入口
复用官方 OpenIMLive 信令与房间,换票改走账号服务 /api/rtc_token;入口仅音频,占线/超时/重复回调与销毁释放由公司层防护。 Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
2a817e77d8
commit
3832e080c4
@@ -134,6 +134,11 @@ mixin OpenIMLive {
|
||||
),
|
||||
onError: onError,
|
||||
onRoomDisconnected: () => onRoomDisconnected(event.data),
|
||||
onStartCalling: onLiveConnected,
|
||||
onClose: () {
|
||||
_stopSound();
|
||||
onLiveSessionClosed();
|
||||
},
|
||||
);
|
||||
} else if (event.state == CallState.beRejected) {
|
||||
insertSignalingMessageSubject.add(event);
|
||||
@@ -224,10 +229,14 @@ mixin OpenIMLive {
|
||||
onBusyLine: onBusyLine,
|
||||
onStartCalling: () {
|
||||
_stopSound();
|
||||
onLiveConnected();
|
||||
},
|
||||
onError: onError,
|
||||
onRoomDisconnected: () => onRoomDisconnected(signal),
|
||||
onClose: _stopSound,
|
||||
onClose: () {
|
||||
_stopSound();
|
||||
onLiveSessionClosed();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -255,11 +264,20 @@ mixin OpenIMLive {
|
||||
offlinePushInfo: OfflinePushInfo(),
|
||||
userID: signaling.invitation!.inviteeUserIDList!.first,
|
||||
isOnlineOnly: true);
|
||||
final certificate = await Apis.getTokenForRTC(signaling.invitation!.roomID!, OpenIM.iMManager.userID);
|
||||
final certificate = await getRtcCertificate(signaling.invitation!.roomID!, OpenIM.iMManager.userID);
|
||||
|
||||
return certificate;
|
||||
}
|
||||
|
||||
/// 公司层可覆盖:走账号服务 `/api/rtc_token`,默认仍走官方 chat 换票。
|
||||
Future<SignalingCertificate> getRtcCertificate(String roomID, String userID) {
|
||||
return Apis.getTokenForRTC(roomID, userID);
|
||||
}
|
||||
|
||||
void onLiveSessionClosed() {}
|
||||
|
||||
void onLiveConnected() {}
|
||||
|
||||
Future<SignalingCertificate> onTapPickup(SignalingInfo signaling) async {
|
||||
_beCalledEvent = null; // ios bug
|
||||
_autoPickup = false;
|
||||
@@ -272,7 +290,7 @@ mixin OpenIMLive {
|
||||
offlinePushInfo: OfflinePushInfo(),
|
||||
userID: signaling.invitation!.inviterUserID,
|
||||
isOnlineOnly: true);
|
||||
final certificate = await Apis.getTokenForRTC(signaling.invitation!.roomID!, OpenIM.iMManager.userID);
|
||||
final certificate = await getRtcCertificate(signaling.invitation!.roomID!, OpenIM.iMManager.userID);
|
||||
|
||||
return certificate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user