修复rtc
This commit is contained in:
parent
b076e43180
commit
144cfc8e22
@ -135,23 +135,25 @@ class RealTimeCommunicationManager extends ChangeNotifier {
|
||||
onUserOffline: (connection, remoteUid, reason) {
|
||||
print('rtc用户 $remoteUid 离开了频道 (原因: ${reason})');
|
||||
},
|
||||
onTokenPrivilegeWillExpire: (
|
||||
RtcConnection connection,
|
||||
String token,
|
||||
) async {
|
||||
var rtcToken = await SCAccountRepository().getRtcToken(
|
||||
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
||||
);
|
||||
engine?.renewToken(rtcToken.rtcToken ?? "");
|
||||
},
|
||||
onTokenPrivilegeWillExpire: (
|
||||
RtcConnection connection,
|
||||
String token,
|
||||
) async {
|
||||
var rtcToken = await SCAccountRepository().getRtcToken(
|
||||
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
||||
isPublisher: isOnMai(),
|
||||
);
|
||||
engine?.renewToken(rtcToken.rtcToken ?? "");
|
||||
},
|
||||
onAudioVolumeIndication: initializeAudioVolumeIndicationCallback,
|
||||
),
|
||||
);
|
||||
var rtcToken = await SCAccountRepository().getRtcToken(
|
||||
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
||||
);
|
||||
var rtcToken = await SCAccountRepository().getRtcToken(
|
||||
currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||
AccountStorage().getCurrentUser()?.userProfile?.id ?? "",
|
||||
isPublisher: false,
|
||||
);
|
||||
await engine?.joinChannel(
|
||||
token: rtcToken.rtcToken ?? "",
|
||||
channelId: currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
||||
|
||||
@ -63,11 +63,15 @@ abstract class SocialChatUserRepository {
|
||||
///发送心跳
|
||||
Future heartbeat(String status, bool upMick, {String? roomId});
|
||||
|
||||
///上麦心跳
|
||||
Future anchorHeartbeat(String roomId);
|
||||
|
||||
///声网token
|
||||
Future<SCRtcTokenRes> getRtcToken(String channel, String userId);
|
||||
///上麦心跳
|
||||
Future anchorHeartbeat(String roomId);
|
||||
|
||||
///声网token
|
||||
Future<SCRtcTokenRes> getRtcToken(
|
||||
String channel,
|
||||
String userId, {
|
||||
bool isPublisher = false,
|
||||
});
|
||||
|
||||
///退出房间
|
||||
Future<bool> quitRoom(String roomId);
|
||||
|
||||
@ -209,16 +209,24 @@ class SCAccountRepository implements SocialChatUserRepository {
|
||||
return result;
|
||||
}
|
||||
|
||||
///external/im-trtc/tmp/agora/sig
|
||||
@override
|
||||
Future<SCRtcTokenRes> getRtcToken(String channel, String userId) async {
|
||||
final result = await http.get(
|
||||
"2572c69d25a0946b0cb35b24bdfcd61c9bcef4afdaced7dfc47a641bd9584f96",
|
||||
queryParams: {"channelName": channel, "userId": userId},
|
||||
fromJson: (json) => SCRtcTokenRes.fromJson(json),
|
||||
);
|
||||
return result;
|
||||
}
|
||||
///external/im-trtc/tmp/agora/sig
|
||||
@override
|
||||
Future<SCRtcTokenRes> getRtcToken(
|
||||
String channel,
|
||||
String userId, {
|
||||
bool isPublisher = false,
|
||||
}) async {
|
||||
final result = await http.get(
|
||||
"2572c69d25a0946b0cb35b24bdfcd61c9bcef4afdaced7dfc47a641bd9584f96",
|
||||
queryParams: {
|
||||
"channelName": channel,
|
||||
"userId": userId,
|
||||
"isPublisher": isPublisher,
|
||||
},
|
||||
fromJson: (json) => SCRtcTokenRes.fromJson(json),
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
///live/room/quit
|
||||
@override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user