视频数据显示Error修复及图片处理优化

This commit is contained in:
Daisy 2024-03-26 15:31:04 +08:00
parent c0e907bafa
commit a774b6a437
3 changed files with 22 additions and 19 deletions

View File

@ -3,7 +3,6 @@ import 'dart:math';
import 'package:flutter/services.dart';
import 'package:flutter_voice_processor/flutter_voice_processor.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/talk/call/callTalk.dart';

View File

@ -40,16 +40,23 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
height: 1.sh,
child: Stack(
children: [
Obx(() => state.listPhotoData.value.isEmpty
? Container(color: Colors.transparent)
: Image.memory(
state.listPhotoData.value,
// key: ValueKey<int>(state.listData.value.hashCode),
gaplessPlayback: true,
width: 1.sw,
height: 1.sh,
fit: BoxFit.cover,
)),
Obx(() {
if (state.listPhotoData.value.isEmpty ||
state.listPhotoData.value.length < 10) {
return Container(color: Colors.transparent);
} else {
return Image.memory(
state.listPhotoData.value,
gaplessPlayback: true,
width: 1.sw,
height: 1.sh,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Container(color: Colors.transparent);
},
);
}
}),
Positioned(
top: ScreenUtil().statusBarHeight + 30.h,
width: 1.sw,

View File

@ -71,12 +71,7 @@ class CallTalk {
// print('获取帧序号 getIframeIndex$getIframeIndex');
// 65
// int alen = bb[POS_alen] & 0xff;
// var alenList = bb.sublist(POS_alen, POS_alen + 4);
// int alen = ((0xff & alenList[(0)]) << 24 |
// (0xff & alenList[1]) << 16 |
// (0xff & alenList[2]) << 8 |
// (0xFF & alenList[3]));
int alen = bb[POS_alen] + bb[POS_alen + 1] * 256;
// print('获取帧长度 alen$alen');
// 71
@ -94,7 +89,7 @@ class CallTalk {
iframe = IframeInfo();
iframe!.iframeIndex = getIframeIndex;
iframe!.bagNum = getBagNum;
// iframe!.cur_len = alen;
iframe!.cur_len = alen;
iframe!.bb = [];
// growableList = iframe!.bb!.toList(growable: true);
}
@ -107,12 +102,14 @@ class CallTalk {
iframe!.bb!.addAll(getList);
}
// print(
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
//
if (iframe!.bagNum == iframe!.bagReceive &&
iframe!.bagReceive == getBagNum &&
getIframeIndex == iframe!.iframeIndex) {
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
} else {
// print('接收到的包数不等于总包数');