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