This commit is contained in:
魏少阳 2024-01-08 17:58:25 +08:00
commit 89710ffcf0
5 changed files with 45 additions and 34 deletions

View File

@ -433,5 +433,9 @@ class RealTimePictureLogic extends BaseGetXController {
state.oneMinuteTimeTimer.cancel();
}
stopProcessing();
state.listData.value = Uint8List(0);
if (state.realTimePicTimer != null) {
state.realTimePicTimer.cancel();
}
}
}

View File

@ -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();
}
}

View File

@ -19,7 +19,6 @@ class CallTalk {
int status = 0; //
IframeInfo? iframe; //
var growableList;
bool getFirstFrame = false; //
List<int> allDataBytes = <int>[]; //
@ -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 = [];
}
}

View File

@ -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 = [];
}
}

View File

@ -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: