fix:调整为收到预期接收数据回复之后才进行页面跳转和播放铃声

This commit is contained in:
liyi 2025-06-10 09:25:45 +08:00
parent 500f705fc5
commit 0105a3ca72
2 changed files with 54 additions and 44 deletions

View File

@ -4,7 +4,9 @@ import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/talk/starChart/constant/message_type_constant.dart';
import 'package:star_lock/talk/starChart/constant/talk_status.dart';
import 'package:star_lock/talk/starChart/entity/scp_message.dart';
@ -16,6 +18,8 @@ import 'package:star_lock/talk/starChart/proto/talk_data.pb.dart';
import 'package:star_lock/talk/starChart/proto/talk_expect.pb.dart';
import 'package:star_lock/talk/starChart/views/talkView/talk_view_logic.dart';
import 'package:star_lock/talk/starChart/views/talkView/talk_view_state.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/storage.dart';
import '../../star_chart_manage.dart';
@ -32,10 +36,14 @@ class UdpTalkExpectHandler extends ScpMessageBaseHandle
}
@override
void handleResp(ScpMessage scpMessage) {
void handleResp(ScpMessage scpMessage) async {
//
final TalkExpectResp talkExpectResp = scpMessage.Payload;
if (talkExpectResp != null) {
//
//test:使
playRingtone();
// print('收到预期音视频数据回复,scpMessage:$scpMessage');
//
startChartManage.stopTalkExpectMessageTimer();
@ -45,7 +53,7 @@ class UdpTalkExpectHandler extends ScpMessageBaseHandle
startChartManage.rotateAngle = talkExpectResp.rotate;
startChartManage.videoWidth = talkExpectResp.width;
startChartManage.videoHeight = talkExpectResp.height;
AppLog.log('视频画面需要旋转:${talkExpectResp.rotate},画面宽高:${talkExpectResp.width}-${talkExpectResp.height}');
//
// x秒内没有收到通话保持则执行的操作;
talkePingOverTimeTimerManager.start();
@ -59,6 +67,50 @@ class UdpTalkExpectHandler extends ScpMessageBaseHandle
// ping
startChartManage.startTalkPingMessageTimer();
}
AppLog.log(
'视频画面需要旋转:${talkExpectResp.rotate},画面宽高:${talkExpectResp.width}-${talkExpectResp.height}');
//
final LockListInfoItemEntity currentKeyInfo =
CommonDataManage().currentKeyInfo;
// 0wifi保活 1wifi不保活图传 2wifi不保活可视对讲
var isWifiLockType = currentKeyInfo.lockFeature?.wifiLockType == 1;
final LockListInfoGroupEntity? lockListInfoGroupEntity =
await Storage.getLockMainListData();
if (lockListInfoGroupEntity != null) {
lockListInfoGroupEntity!.groupList?.forEach((element) {
final lockList = element.lockList;
if (lockList != null && lockList.length != 0) {
for (var lockInfo in lockList) {
final peerId = lockInfo.network?.peerId;
if (peerId != null && peerId != '') {
if (peerId == scpMessage.FromPeerId) {
isWifiLockType = lockInfo.lockFeature?.wifiLockType == 1;
}
}
}
}
});
}
if (isWifiLockType ||
(talkExpectResp.rotate == 0 &&
talkExpectResp.width == 640 &&
talkExpectResp.height == 480)) {
Get.toNamed(Routers.imageTransmissionView);
return;
}
if (startChartManage
.getDefaultTalkExpect()
.videoType
.contains(VideoTypeE.H264)) {
Get.toNamed(
Routers.h264WebView,
);
} else {
Get.toNamed(
Routers.starChartTalkView,
);
}
}
}

View File

@ -90,52 +90,10 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle
}) async {
//
_handleRequestSendExpect(lockPeerID: lockPeerID);
//
//test:使
playRingtone();
//
// _showTalkRequestNotification(talkObjectName: talkObjectName);
//
talkStatus.setPassiveCallWaitingAnswer();
//
final LockListInfoItemEntity currentKeyInfo =
CommonDataManage().currentKeyInfo;
var isWifiLockType = currentKeyInfo.lockFeature?.wifiLockType == 1;
final LockListInfoGroupEntity? lockListInfoGroupEntity =
await Storage.getLockMainListData();
if (lockListInfoGroupEntity != null) {
lockListInfoGroupEntity!.groupList?.forEach((element) {
final lockList = element.lockList;
if (lockList != null && lockList.length != 0) {
for (var lockInfo in lockList) {
final peerId = lockInfo.network?.peerId;
if (peerId != null && peerId != '') {
if (peerId == lockPeerID) {
isWifiLockType = lockInfo.lockFeature?.wifiLockType == 1;
}
}
}
}
});
}
if (isWifiLockType) {
Get.toNamed(Routers.imageTransmissionView);
return;
}
if (startChartManage
.getDefaultTalkExpect()
.videoType
.contains(VideoTypeE.H264)) {
Get.toNamed(
Routers.h264WebView,
);
} else {
Get.toNamed(
Routers.starChartTalkView,
);
}
}
//