1,解决对讲图片数据有问题时闪现白色错误图片
2,新增监控结束后 停止发送监视请求的计时器
This commit is contained in:
parent
3cf7449b0e
commit
e8aabb052a
@ -433,5 +433,9 @@ class RealTimePictureLogic extends BaseGetXController {
|
||||
state.oneMinuteTimeTimer.cancel();
|
||||
}
|
||||
stopProcessing();
|
||||
state.listData.value = Uint8List(0);
|
||||
if (state.realTimePicTimer != null) {
|
||||
state.realTimePicTimer.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/realTimePicture/realTimePicture_logic.dart';
|
||||
import 'package:star_lock/talk/call/callTalk.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/showTFView.dart';
|
||||
@ -70,20 +69,33 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Obx(() => state.listData.value.isEmpty
|
||||
? Image.asset(
|
||||
'images/main/monitorBg.png',
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: ScreenUtil().screenHeight,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.memory(
|
||||
state.listData.value,
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
)),
|
||||
Obx(
|
||||
() =>
|
||||
state.listData.value.isEmpty || state.listData.value.length == 0
|
||||
? Image.asset(
|
||||
'images/main/monitorBg.png',
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: ScreenUtil().screenHeight,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Builder(
|
||||
builder: (BuildContext context) {
|
||||
try {
|
||||
return Image.memory(
|
||||
state.listData.value,
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
print('Error loading image: $e');
|
||||
print('Stack trace: $stackTrace');
|
||||
return Container();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
Obx(() => state.listData.value.isEmpty
|
||||
? Positioned(
|
||||
bottom: 300.h,
|
||||
@ -339,14 +351,12 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
||||
|
||||
void _handleFailure() {
|
||||
// 在这里处理失败的逻辑
|
||||
print('Failed to get response within 30 seconds.');
|
||||
state.animationController.stop();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
state.animationController.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ class CallTalk {
|
||||
|
||||
int status = 0; // 假设有这个成员变量
|
||||
IframeInfo? iframe; // 假设有这个成员变量
|
||||
var growableList;
|
||||
bool getFirstFrame = false; //是否得到了第一帧
|
||||
List<int> allDataBytes = <int>[]; //音频数据
|
||||
|
||||
@ -71,7 +70,7 @@ class CallTalk {
|
||||
// 获取帧序号 63
|
||||
int getIframeIndex =
|
||||
bb[POS_iframe_index] + bb[POS_iframe_index + 1] * 256;
|
||||
print('获取帧序号 getIframeIndex:$getIframeIndex');
|
||||
// print('获取帧序号 getIframeIndex:$getIframeIndex');
|
||||
|
||||
// 获取帧长度 65
|
||||
// int alen = bb[POS_alen] & 0xff;
|
||||
@ -84,10 +83,10 @@ class CallTalk {
|
||||
|
||||
// 当前包号 71
|
||||
int getBagIndex = bb[POS_bag_index] & 0xff;
|
||||
print('当前包号 getBagIndex:$getBagIndex');
|
||||
// print('当前包号 getBagIndex:$getBagIndex');
|
||||
// 总包数 69
|
||||
int getBagNum = bb[POS_bag_num] & 0xff;
|
||||
print('总包数 getBagNum:$getBagNum');
|
||||
// print('总包数 getBagNum:$getBagNum');
|
||||
// 数据长度 73
|
||||
int blen = bb[POS_blen] + bb[POS_blen + 1] * 256;
|
||||
// print('数据长度 blen:$blen');
|
||||
@ -98,8 +97,8 @@ class CallTalk {
|
||||
iframe!.iframeIndex = getIframeIndex;
|
||||
iframe!.bagNum = getBagNum;
|
||||
// iframe!.cur_len = alen;
|
||||
// iframe!.bb = Uint8List(alen);
|
||||
growableList = iframe!.bb!.toList(growable: true);
|
||||
iframe!.bb = [];
|
||||
// growableList = iframe!.bb!.toList(growable: true);
|
||||
}
|
||||
|
||||
iframe!.bagReceive++;
|
||||
@ -107,22 +106,14 @@ class CallTalk {
|
||||
// 如果是同一帧就添加起来
|
||||
if (getIframeIndex == iframe!.iframeIndex) {
|
||||
var getList = bb.sublist(77, bb.length);
|
||||
growableList.addAll(getList);
|
||||
iframe!.bb!.addAll(getList);
|
||||
}
|
||||
// print('iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
|
||||
|
||||
// 如果收到的包数等于总包数,说明这一帧数据已经接收完毕
|
||||
if (iframe!.bagNum == iframe!.bagReceive) {
|
||||
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
||||
|
||||
//判断第一帧是否接收到
|
||||
// if (iframe!.iframeIndex == 0) {
|
||||
// print('得到第一帧了么');
|
||||
// getFirstFrame = true;
|
||||
// eventBus.fire(GetFirstFrameGoPush(getFirstFrame));
|
||||
// }
|
||||
|
||||
eventBus.fire(GetTVDataRefreshUI(growableList));
|
||||
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,6 +156,6 @@ class CallTalk {
|
||||
iframe!.iframeIndex = 0;
|
||||
iframe!.bagNum = 0;
|
||||
iframe!.bagReceive = 0;
|
||||
growableList = [];
|
||||
iframe!.bb = [];
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,11 +4,11 @@ class IframeInfo {
|
||||
int iframeIndex = -1;
|
||||
int iframeTime = 0;
|
||||
int bagNum = 0;
|
||||
int bagReceive = 0;
|
||||
int bagReceive = 1;
|
||||
bool isFull = false;
|
||||
int cur_len = 0;
|
||||
int bb_len = 0;
|
||||
Uint8List? bb;
|
||||
List<int>? bb;
|
||||
int codecMode = 0;
|
||||
|
||||
IframeInfo() {
|
||||
@ -17,6 +17,6 @@ class IframeInfo {
|
||||
bagReceive = 0;
|
||||
isFull = false;
|
||||
cur_len = 0;
|
||||
bb = Uint8List(0);
|
||||
bb = [];
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,6 +196,12 @@ class CommandUDPReciverManager {
|
||||
//结束对讲反馈
|
||||
print("结束监视反馈");
|
||||
}
|
||||
UDPTalkClass().status = 0;
|
||||
UDPTalkClass().isBeCall = false;
|
||||
UDPTalkClass().stopLocalAudio();
|
||||
CallTalk().stopPcmSound();
|
||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||
Get.back();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user