修复对讲接收视频bug

This commit is contained in:
魏少阳 2023-12-21 13:56:48 +08:00
parent 5f9e061ee3
commit 81488b599e
6 changed files with 36 additions and 17 deletions

View File

@ -28,7 +28,7 @@ class LockMonitoringLogic extends BaseGetXController {
StreamSubscription? _getUDPStatusRefreshUIEvent;
void _getUDPStatusRefreshUIAction() {
// eventBus
_getTVDataRefreshUIEvent = eventBus.on<GetUDPStatusRefreshUI>().listen((event) {
_getUDPStatusRefreshUIEvent = eventBus.on<GetUDPStatusRefreshUI>().listen((event) {
state.udpStatus.value = event.udpStatus;
});
}

View File

@ -8,6 +8,7 @@ import 'package:network_info_plus/network_info_plus.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../talk/udp/udp_manage.dart';
import '../../../../talk/udp/udp_senderManage.dart';
import '../../../../talk/udp/udp_talkClass.dart';
import '../../../../tools/showTFView.dart';
import '../../../../tools/storage.dart';
import '../../../../tools/toast.dart';
@ -158,6 +159,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
Widget bottomBottomBtnWidget() {
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
//
Obx(() => bottomBtnItemWidget(
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
var userMobileIP = await NetworkInfo().getWifiIP();
@ -281,6 +283,10 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
title: "请输入开锁密码",
tipTitle: "",
controller: state.passwordTF,
inputFormatters: [
LengthLimitingTextInputFormatter(6), //
FilteringTextInputFormatter.allow(RegExp("[0-9]")),
],
sureClick: () async {
//
if (state.passwordTF.text.isEmpty) {
@ -311,6 +317,13 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
);
}
@override
void dispose() {
super.dispose();
// UDPTalkClass().isBeCall = false;
}
//
_initRecorder() {
recorder = FlutterSoundRecorder();

View File

@ -67,7 +67,8 @@ 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;
// var alenList = bb.sublist(POS_alen, POS_alen + 4);
@ -79,13 +80,13 @@ 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');
// print('数据长度 blen$blen');
// IframeInfo
if (getIframeIndex != iframe!.iframeIndex) {
@ -104,13 +105,11 @@ class CallTalk {
var getList = bb.sublist(77, bb.length);
growableList.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) {
print(
'播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
//
if (iframe!.iframeIndex == 0) {

View File

@ -19,7 +19,7 @@ class CommandUDPReciverManager {
if (dataSize < 4) {
return;
}
// print("appReceiveUDPData:$data");
print("appReceiveUDPData:$data");
Uint8List data1 = Uint8List.fromList(data);
if (data1.length == 1) {
@ -52,7 +52,7 @@ class CommandUDPReciverManager {
var lockId = data.sublist(9, 29);
var lockIdStr = utf8String(lockId);
UDPManage().lockId = lockIdStr;
UDPTalkClass().status = 0;
UDPTalkClass().beCallW(data: data);
}
break;
@ -112,6 +112,7 @@ class CommandUDPReciverManager {
print("结束对讲反馈");
}
UDPTalkClass().status = 0;
UDPTalkClass().isBeCall = false;
Get.back();
UDPTalkClass().stopLocalAudio();
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));

View File

@ -23,7 +23,9 @@ class UDPTalkClass {
UDPTalkClass._init();
var status = 0; //0 1 2 3 4 5 6 8
// var status = 0; //0 1 2 3 4 5 6 8
int status = 0;
var remoteEquid; //
late Timer timer;
// 退
@ -31,7 +33,7 @@ class UDPTalkClass {
final audioPlayer = AudioPlayer();
beCallW({List<int>? data, String? ip, int? port}) async {
// print("beCall");
print("beCall status:$status");
// if (await isCallMe(data)) {
// return;
// }
@ -60,8 +62,8 @@ class UDPTalkClass {
// fullscreenDialog: true
// ));
if (UDPTalkClass().isBeCall == false) {
UDPTalkClass().isBeCall = true;
if (isBeCall == false) {
isBeCall = true;
//
timer = Timer.periodic(1.seconds, (timer) {
data[7] = 1;
@ -70,10 +72,10 @@ class UDPTalkClass {
});
// _getFirstFrameGoPushAction();
Future.delayed(const Duration(seconds: 1), () {
// Future.delayed(const Duration(seconds: 1), () {
//
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
});
// });
}
playLocalAudio();

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -9,6 +10,7 @@ class ShowTFView extends StatelessWidget {
String? title;
String? tipTitle;
TextEditingController? controller;
List<TextInputFormatter>? inputFormatters;
Function()? sureClick;
Function()? cancelClick;
@ -17,6 +19,7 @@ class ShowTFView extends StatelessWidget {
this.title,
this.tipTitle,
this.controller,
this.inputFormatters,
this.sureClick,
this.cancelClick})
: super(key: key);
@ -44,6 +47,7 @@ class ShowTFView extends StatelessWidget {
maxLines: 1,
controller: controller,
autofocus: false,
inputFormatters: inputFormatters,
decoration: InputDecoration(
contentPadding:
const EdgeInsets.only(left: 5, top: -8, bottom: 6),