1.网络访问失败的时长增加到6s
2.推送的debugPrint删除 3.判断2.4G的wifi删除 4.鸿蒙6.0视频对讲动画转太快
This commit is contained in:
parent
9a76dcd232
commit
be0577bb55
@ -14,7 +14,6 @@ class AppLog {
|
||||
}
|
||||
|
||||
static void log(String msg, {StackTrace? stackTrace, bool? error}) {
|
||||
debugPrint(msg);
|
||||
msg = '${DateTime.now().toIso8601String()} : $msg';
|
||||
DebugConsole.info(msg, stackTrace: stackTrace, isErr: error ?? false);
|
||||
if (!kDebugMode) {
|
||||
|
||||
@ -65,23 +65,33 @@ class SenderBeforeDataManage {
|
||||
|
||||
// 解析添加用户订阅
|
||||
Future<void> _replyAddUserKey(Reply reply) async {
|
||||
// 检查数据长度,避免索引越界
|
||||
if (reply.data.length < 47) {
|
||||
return; // 数据长度不足,直接返回
|
||||
}
|
||||
|
||||
final int status = reply.data[46];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
final List<int> userNoData = reply.data.sublist(47, 49);
|
||||
CommonDataManage().currentLockUserNo = listChangInt(userNoData);
|
||||
CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo;
|
||||
// 再次检查长度确保sublist安全
|
||||
if (reply.data.length >= 49) {
|
||||
final List<int> userNoData = reply.data.sublist(47, 49);
|
||||
CommonDataManage().currentLockUserNo = listChangInt(userNoData);
|
||||
CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo;
|
||||
|
||||
_updateLockUserNo(userNoData);
|
||||
_updateLockUserNo(userNoData);
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
final List<int> token = reply.data.sublist(42, 46);
|
||||
final List<String> strTokenList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, strTokenList);
|
||||
final List<int> addUserData = await getAddUserKeyData(tokenList: token);
|
||||
eventBus.fire(LockAddUserSucceedEvent(addUserData, 1));
|
||||
if (reply.data.length >= 46) {
|
||||
final List<int> token = reply.data.sublist(42, 46);
|
||||
final List<String> strTokenList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, strTokenList);
|
||||
final List<int> addUserData = await getAddUserKeyData(tokenList: token);
|
||||
eventBus.fire(LockAddUserSucceedEvent(addUserData, 1));
|
||||
}
|
||||
break;
|
||||
case 0x0c:
|
||||
//锁设备用户超过 32个,需要同步锁用户列表刷新
|
||||
|
||||
@ -65,13 +65,6 @@ class _ConfiguringWifiPageState extends State<ConfiguringWifiPage>
|
||||
logic.showToast('请输入WiFi密码'.tr);
|
||||
return;
|
||||
}
|
||||
// 检查WiFi名称是否包含5G关键字
|
||||
if (state.wifiNameController.text
|
||||
.toLowerCase()
|
||||
.contains('5g')) {
|
||||
logic.showToast('请确保使用2.4GHz WiFi网络'.tr);
|
||||
return;
|
||||
}
|
||||
logic.senderConfiguringWifiAction();
|
||||
},
|
||||
),
|
||||
|
||||
@ -108,7 +108,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
}
|
||||
if (res.body == null) {
|
||||
if (res.statusCode == null && isShowErrMsg!) {
|
||||
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
|
||||
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 6000.milliseconds);
|
||||
}
|
||||
var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'};
|
||||
return Response(
|
||||
|
||||
@ -37,8 +37,6 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
||||
startChartManage.stopSendingRbcuInfoMessages();
|
||||
startChartManage.stopSendingRbcuProBeMessages();
|
||||
startChartManage.stopTalkHangupMessageTimer();
|
||||
// 设置最终结束状态
|
||||
talkStatus.setEnd();
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
@ -57,8 +55,6 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
||||
startChartManage.stopSendingRbcuInfoMessages();
|
||||
startChartManage.stopSendingRbcuProBeMessages();
|
||||
startChartManage.stopTalkHangupMessageTimer();
|
||||
// 设置最终结束状态
|
||||
talkStatus.setEnd();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -70,13 +66,13 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
||||
@override
|
||||
deserializePayload(
|
||||
{required int payloadType,
|
||||
required int messageType,
|
||||
required List<int> byte,
|
||||
int? offset,
|
||||
int? PayloadLength,
|
||||
int? spTotal,
|
||||
int? spIndex,
|
||||
int? messageId}) {
|
||||
required int messageType,
|
||||
required List<int> byte,
|
||||
int? offset,
|
||||
int? PayloadLength,
|
||||
int? spTotal,
|
||||
int? spIndex,
|
||||
int? messageId}) {
|
||||
if (messageType == MessageTypeConstant.Resp) {
|
||||
final GenericResp genericResp = GenericResp();
|
||||
genericResp.mergeFromBuffer(byte);
|
||||
|
||||
@ -1,13 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/talk/other/audio_player_manager.dart';
|
||||
import 'package:star_lock/talk/starChart/constant/payload_type_constant.dart';
|
||||
@ -32,11 +25,11 @@ class ScpMessageBaseHandle {
|
||||
/// 使用单例 TimerManager
|
||||
/// 超时处理
|
||||
final TalkeRequestOverTimeTimerManager talkeRequestOverTimeTimerManager =
|
||||
TalkeRequestOverTimeTimerManager();
|
||||
TalkeRequestOverTimeTimerManager();
|
||||
final TalkePingOverTimeTimerManager talkePingOverTimeTimerManager =
|
||||
TalkePingOverTimeTimerManager();
|
||||
TalkePingOverTimeTimerManager();
|
||||
final TalkDataOverTimeTimerManager talkDataOverTimeTimerManager =
|
||||
TalkDataOverTimeTimerManager();
|
||||
TalkDataOverTimeTimerManager();
|
||||
|
||||
final startChartManage = StartChartManage();
|
||||
|
||||
@ -56,7 +49,7 @@ class ScpMessageBaseHandle {
|
||||
|
||||
// 处理出完整帧数据后的回调
|
||||
final H264FrameHandler frameHandler =
|
||||
H264FrameHandler(onCompleteFrame: (TalkDataModel talkDataModel) {
|
||||
H264FrameHandler(onCompleteFrame: (TalkDataModel talkDataModel) {
|
||||
// 处理完整的帧数据
|
||||
TalkDataRepository.instance.addTalkData(
|
||||
talkDataModel,
|
||||
@ -98,10 +91,6 @@ class ScpMessageBaseHandle {
|
||||
|
||||
// 播放铃声
|
||||
void playRingtone() async {
|
||||
// 监控模式下不播放铃声
|
||||
if (startChartManage.isMonitoring) {
|
||||
return;
|
||||
}
|
||||
//test:使用自定义铃声
|
||||
await audioManager.playRingtone();
|
||||
}
|
||||
|
||||
@ -94,7 +94,6 @@ class StartChartManage {
|
||||
final String echoPeerId = '3phX8Ng2cZHz5NtP8xAf6nYy2z1BYytoejgjoHrWMGhH';
|
||||
|
||||
bool isOnlineStarChartServer = false; // 星图是否上线成功
|
||||
bool isMonitoring = false; // 是否处于监控模式
|
||||
Timer? reStartOnlineStartChartServerTimer; // 重新上线定时器
|
||||
Timer? talkPingTimer; // 发送通话保持消息定时器
|
||||
Timer? talkExpectTimer; // 发送通话预期消息定时器
|
||||
@ -162,18 +161,6 @@ class StartChartManage {
|
||||
await reportInformation();
|
||||
}
|
||||
|
||||
// 优化连接建立
|
||||
// Future<void> establishConnection({required String ToPeerId}) async {
|
||||
// // 提前预加载必要资源
|
||||
// await init(); // 确保基础服务已初始化
|
||||
//
|
||||
// // 并行执行地址交换和打洞
|
||||
// await Future.wait([
|
||||
// startSendingRbcuInfoMessages(ToPeerId: ToPeerId),
|
||||
// startSendingRbcuProbeTMessages(),
|
||||
// ] as Iterable<Future>);
|
||||
// }
|
||||
|
||||
/// 客户端注册
|
||||
Future<void> _clientRegister(LoginData? loginData) async {
|
||||
if (loginData?.starchart?.starchartId != null) {
|
||||
@ -434,11 +421,7 @@ class StartChartManage {
|
||||
}
|
||||
|
||||
/// 启动持续发送对讲请求
|
||||
void startCallRequestMessageTimer({required String ToPeerId, bool isMonitoring = false}) async {
|
||||
// 更新全局ToPeerId为当前要连接的锁的peerId
|
||||
this.ToPeerId = ToPeerId;
|
||||
this.lockPeerId = ToPeerId;
|
||||
this.isMonitoring = isMonitoring;
|
||||
void startCallRequestMessageTimer({required String ToPeerId}) async {
|
||||
// 如果已经处于等待接听状态就不发送
|
||||
// if (talkStatus.status != TalkStatus.proactivelyCallWaitingAnswer) {
|
||||
// // 如果是h264则跳转至webview
|
||||
@ -474,28 +457,22 @@ class StartChartManage {
|
||||
// 启动定时器持续发送对讲请求
|
||||
talkRequestTimer ??= Timer.periodic(
|
||||
Duration(
|
||||
milliseconds: _defaultIntervalTime,
|
||||
// milliseconds: 500,
|
||||
seconds: _defaultIntervalTime,
|
||||
),
|
||||
(Timer timer) async {
|
||||
AppLog.log('发送对讲请求:${ToPeerId}');
|
||||
await sendCallRequestMessage(ToPeerId: ToPeerId);
|
||||
},
|
||||
);
|
||||
// 只有非监控模式才设置为等待接听状态
|
||||
if (!isMonitoring) {
|
||||
talkStatus.setProactivelyCallWaitingAnswer();
|
||||
// 启动对讲请求应答超时判断
|
||||
talkeRequestOverTimeTimerManager.start();
|
||||
}
|
||||
talkStatus.setProactivelyCallWaitingAnswer();
|
||||
// 启动对讲请求应答超时判断
|
||||
talkeRequestOverTimeTimerManager.start();
|
||||
}
|
||||
|
||||
/// 停止持续发送对讲请求
|
||||
void stopCallRequestMessageTimer() async {
|
||||
talkRequestTimer?.cancel();
|
||||
talkRequestTimer = null;
|
||||
// 重置监控模式状态
|
||||
isMonitoring = false;
|
||||
}
|
||||
|
||||
// 发送对讲请求消息
|
||||
@ -554,10 +531,6 @@ class StartChartManage {
|
||||
_log(text: '心跳已经开始了. 请勿重复发送心跳包消息');
|
||||
return;
|
||||
}
|
||||
// 确保定时器不存在后再创建
|
||||
// if (_heartBeatTimer != null) {
|
||||
// _heartBeatTimer?.cancel();
|
||||
// }
|
||||
_heartBeatTimer ??= Timer.periodic(
|
||||
Duration(
|
||||
seconds: heartbeatIntervalTime,
|
||||
@ -740,19 +713,13 @@ class StartChartManage {
|
||||
// _log(text: '发送通话保持');
|
||||
}
|
||||
|
||||
Future<void> _sendTalkHangupMessage() async {
|
||||
void _sendTalkHangupMessage() async {
|
||||
final message = MessageCommand.talkHangupMessage(
|
||||
ToPeerId: ToPeerId,
|
||||
FromPeerId: FromPeerId,
|
||||
MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: true),
|
||||
);
|
||||
try {
|
||||
await _sendMessage(message: message);
|
||||
} catch (e) {
|
||||
// 记录日志但不中断程序执行
|
||||
AppLog.log('发送挂断消息失败: $e');
|
||||
// 不抛出异常,避免应用崩溃
|
||||
}
|
||||
await _sendMessage(message: message);
|
||||
}
|
||||
|
||||
// 发送通话中挂断消息
|
||||
@ -761,7 +728,7 @@ class StartChartManage {
|
||||
talkHangupTimer ??= Timer.periodic(
|
||||
Duration(seconds: _defaultIntervalTime),
|
||||
(Timer timer) async {
|
||||
await _sendTalkHangupMessage();
|
||||
_sendTalkHangupMessage();
|
||||
},
|
||||
);
|
||||
|
||||
@ -833,16 +800,9 @@ class StartChartManage {
|
||||
// 发送消息
|
||||
Future<void> _sendMessage({required List<int> message}) async {
|
||||
var result = await _udpSocket?.send(message, InternetAddress(remoteHost), remotePort);
|
||||
// 在对讲管理类中完善异常处理
|
||||
try {
|
||||
// UDP发送逻辑
|
||||
} catch (e) {
|
||||
// 记录错误但不影响主流程
|
||||
if (result != message.length) {
|
||||
throw StartChartMessageException('❌Udp send data error----> $result ${message.length}');
|
||||
// _udpSocket = null;
|
||||
}
|
||||
print('对讲消息发送失败: $e');
|
||||
if (result != message.length) {
|
||||
throw StartChartMessageException('❌Udp send data error----> $result ${message.length}');
|
||||
// _udpSocket = null;
|
||||
}
|
||||
|
||||
//ToDo: 增加对讲调试、正式可删除
|
||||
@ -1084,24 +1044,6 @@ class StartChartManage {
|
||||
void _handleUdpResultData(ScpMessage scpMessage) {
|
||||
final int payloadType = scpMessage.PayloadType ?? 0;
|
||||
final int messageType = scpMessage.MessageType ?? 0;
|
||||
AppLog.log('payloadType:$payloadType,messageType:$messageType');
|
||||
// 添加开锁回应的日志打印
|
||||
if (payloadType == PayloadTypeConstant.remoteUnlock) {
|
||||
AppLog.log('收到蓝牙设备回应消息,${scpMessage.PayloadType}');
|
||||
// 解析回应内容
|
||||
if (scpMessage.Payload != null && scpMessage.Payload!.isNotEmpty) {
|
||||
// 需要根据实际协议格式解析
|
||||
final List<int> payload = scpMessage.Payload!;
|
||||
|
||||
if (payload.length > 2) {
|
||||
final int errorCode = payload[2];
|
||||
if (errorCode == 6) {
|
||||
// 显示"网关正忙,请稍后再试"提示
|
||||
AppLog.log('网关正忙,请稍后再试');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
final ScpMessageHandler handler = ScpMessageHandlerFactory.createHandler(payloadType);
|
||||
if (messageType == MessageTypeConstant.Req) {
|
||||
@ -1260,7 +1202,7 @@ class StartChartManage {
|
||||
final message = MessageCommand.bleMessage(
|
||||
FromPeerId: FromPeerId,
|
||||
ToPeerId: lockPeerId,
|
||||
MessageId: MessageCommand.getNextMessageId(lockPeerId, increment: true),
|
||||
MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: true),
|
||||
bluetoothDeviceName: bluetoothDeviceName,
|
||||
bleStructData: bleStructData,
|
||||
);
|
||||
@ -1275,9 +1217,6 @@ class StartChartManage {
|
||||
status == TalkStatus.proactivelyCallWaitingAnswer ||
|
||||
status == TalkStatus.answeredSuccessfully ||
|
||||
status == TalkStatus.uninitialized) {
|
||||
// 先发送一次挂断消息
|
||||
await _sendTalkHangupMessage();
|
||||
// 再启动定时器确保消息能被接收
|
||||
startTalkRejectMessageTimer();
|
||||
startTalkHangupMessageTimer();
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
|
||||
@ -1,31 +1,18 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/talk/call/callTalk.dart';
|
||||
import 'package:star_lock/talk/starChart/constant/talk_status.dart';
|
||||
import 'package:star_lock/talk/starChart/handle/impl/debug_Info_model.dart';
|
||||
import 'package:star_lock/talk/starChart/handle/impl/udp_talk_data_handler.dart';
|
||||
import 'package:star_lock/talk/starChart/star_chart_manage.dart';
|
||||
import 'package:star_lock/talk/starChart/views/native/talk_view_native_decode_logic.dart';
|
||||
import 'package:star_lock/talk/starChart/views/native/talk_view_native_decode_state.dart';
|
||||
import 'package:star_lock/talk/starChart/views/talkView/talk_view_logic.dart';
|
||||
import 'package:star_lock/talk/starChart/views/talkView/talk_view_state.dart';
|
||||
import 'package:video_decode_plugin/video_decode_plugin.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../app_settings/app_settings.dart';
|
||||
import '../../../../tools/showTFView.dart';
|
||||
|
||||
class TalkViewNativeDecodePage extends StatefulWidget {
|
||||
const TalkViewNativeDecodePage({Key? key}) : super(key: key);
|
||||
@ -76,7 +63,7 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
children: <Widget>[
|
||||
// 悬浮帧率统计信息条
|
||||
Obx(
|
||||
() {
|
||||
() {
|
||||
// 防御性处理:只要loading中或textureId为null,优先渲染loading/占位
|
||||
if (state.isLoading.isTrue || state.textureId.value == null) {
|
||||
return Image.asset(
|
||||
@ -99,16 +86,16 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
quarterTurns: startChartManage.rotateAngle ~/ 90,
|
||||
child: state.isFullScreen.isFalse
|
||||
? AspectRatio(
|
||||
aspectRatio: StartChartManage().videoWidth / StartChartManage().videoHeight,
|
||||
child: Texture(
|
||||
textureId: state.textureId.value!,
|
||||
filterQuality: FilterQuality.low,
|
||||
),
|
||||
)
|
||||
aspectRatio: StartChartManage().videoWidth / StartChartManage().videoHeight,
|
||||
child: Texture(
|
||||
textureId: state.textureId.value!,
|
||||
filterQuality: FilterQuality.medium,
|
||||
),
|
||||
)
|
||||
: Texture(
|
||||
textureId: state.textureId.value!,
|
||||
filterQuality: FilterQuality.low,
|
||||
),
|
||||
textureId: state.textureId.value!,
|
||||
filterQuality: FilterQuality.medium,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -119,32 +106,32 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
|
||||
Obx(() => state.isLoading.isTrue
|
||||
? Positioned(
|
||||
bottom: 310.h,
|
||||
child: Text(
|
||||
'正在创建安全连接...'.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 26.sp),
|
||||
))
|
||||
bottom: 310.h,
|
||||
child: Text(
|
||||
'正在创建安全连接...'.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 26.sp),
|
||||
))
|
||||
: Container()),
|
||||
Obx(() => state.isLoading.isFalse && state.oneMinuteTime.value > 0
|
||||
? Positioned(
|
||||
top: ScreenUtil().statusBarHeight + 75.h,
|
||||
width: 1.sw,
|
||||
child: Obx(
|
||||
() {
|
||||
final String sec = (state.oneMinuteTime.value % 60).toString().padLeft(2, '0');
|
||||
final String min = (state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'$min:$sec',
|
||||
style: TextStyle(fontSize: 26.sp, color: Colors.white),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
top: ScreenUtil().statusBarHeight + 75.h,
|
||||
width: 1.sw,
|
||||
child: Obx(
|
||||
() {
|
||||
final String sec = (state.oneMinuteTime.value % 60).toString().padLeft(2, '0');
|
||||
final String min = (state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'$min:$sec',
|
||||
style: TextStyle(fontSize: 26.sp, color: Colors.white),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: Container()),
|
||||
Positioned(
|
||||
bottom: 10.w,
|
||||
@ -167,30 +154,30 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
Obx(() => state.isLoading.isTrue ? buildRotationTransition() : Container()),
|
||||
Obx(() => state.isLongPressing.value
|
||||
? Positioned(
|
||||
top: 80.h,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.7),
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(Icons.mic, color: Colors.white, size: 24.w),
|
||||
SizedBox(width: 10.w),
|
||||
Text(
|
||||
'正在说话...'.tr,
|
||||
style: TextStyle(fontSize: 20.sp, color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
top: 80.h,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.7),
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(Icons.mic, color: Colors.white, size: 24.w),
|
||||
SizedBox(width: 10.w),
|
||||
Text(
|
||||
'正在说话...'.tr,
|
||||
style: TextStyle(fontSize: 20.sp, color: Colors.white),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container()),
|
||||
],
|
||||
),
|
||||
@ -280,28 +267,28 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: qualities.map((q) {
|
||||
return Obx(() => InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
logic.onQualityChanged(q);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 18.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
q,
|
||||
style: TextStyle(
|
||||
color: state.currentQuality.value == q ? AppColors.mainColor : Colors.black,
|
||||
fontWeight: state.currentQuality.value == q ? FontWeight.bold : FontWeight.normal,
|
||||
fontSize: 28.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
logic.onQualityChanged(q);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 18.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
q,
|
||||
style: TextStyle(
|
||||
color: state.currentQuality.value == q ? AppColors.mainColor : Colors.black,
|
||||
fontWeight: state.currentQuality.value == q ? FontWeight.bold : FontWeight.normal,
|
||||
fontSize: 28.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
@ -337,7 +324,7 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[
|
||||
// 接听
|
||||
Obx(
|
||||
() => bottomBtnItemWidget(
|
||||
() => bottomBtnItemWidget(
|
||||
getAnswerBtnImg(),
|
||||
getAnswerBtnName(),
|
||||
Colors.white,
|
||||
@ -354,10 +341,9 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
state.isLongPressing.value = false;
|
||||
},
|
||||
onClick: () async {
|
||||
// 只有在被动呼叫等待接听状态下才允许接听操作
|
||||
if (state.talkStatus.value == TalkStatus.passiveCallWaitingAnswer) {
|
||||
// 确保不是监控模式下调用
|
||||
if (!state.isMonitoringMode()) {
|
||||
// 非等待监控模式下调用
|
||||
if (state.udpStatus.value != 1) {
|
||||
logic.initiateAnswerCommand();
|
||||
}
|
||||
}
|
||||
@ -390,8 +376,8 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
}
|
||||
|
||||
String getAnswerBtnImg() {
|
||||
// 如果是监控模式,始终显示对讲按钮
|
||||
if (state.isMonitoringMode.value) {
|
||||
// 等待监视模式
|
||||
if (state.udpStatus.value == 1) {
|
||||
return 'images/main/icon_lockDetail_monitoringUnTalkback.png';
|
||||
}
|
||||
switch (state.talkStatus.value) {
|
||||
@ -406,8 +392,8 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
}
|
||||
|
||||
String getAnswerBtnName() {
|
||||
// 如果是监控模式,显示对讲相关文本
|
||||
if (state.isMonitoringMode.value) {
|
||||
// 等待监视模式
|
||||
if (state.udpStatus.value == 1) {
|
||||
return '长按说话'.tr;
|
||||
}
|
||||
switch (state.talkStatus.value) {
|
||||
@ -423,13 +409,13 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
}
|
||||
|
||||
Widget bottomBtnItemWidget(
|
||||
String iconUrl,
|
||||
String name,
|
||||
Color backgroundColor, {
|
||||
required Function() onClick,
|
||||
Function()? longPress,
|
||||
Function()? longPressUp,
|
||||
}) {
|
||||
String iconUrl,
|
||||
String name,
|
||||
Color backgroundColor, {
|
||||
required Function() onClick,
|
||||
Function()? longPress,
|
||||
Function()? longPressUp,
|
||||
}) {
|
||||
double wh = 80.w;
|
||||
return GestureDetector(
|
||||
onTap: onClick,
|
||||
@ -511,6 +497,7 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
state.animationController.dispose();
|
||||
CallTalk().finishAVData();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ class TalkViewNativeDecodeState {
|
||||
TextEditingController passwordTF = TextEditingController();
|
||||
|
||||
RxList<int> listAudioData = <int>[].obs; //得到的音频流字节数据
|
||||
final GlobalKey globalKey = GlobalKey();
|
||||
GlobalKey globalKey = GlobalKey();
|
||||
|
||||
Timer? oneMinuteTimeTimer; // 定时器超过60秒关闭当前界面
|
||||
RxInt oneMinuteTime = 0.obs; // 定时器秒数
|
||||
@ -104,17 +104,13 @@ class TalkViewNativeDecodeState {
|
||||
int lastPerformanceCheck = 0;
|
||||
int lastFrameCount = 0;
|
||||
|
||||
// 添加网络质量状态变量
|
||||
final RxInt networkQualityScore = 1.obs; // 1-5分,5为最佳
|
||||
final RxString networkQualityMessage = ''.obs; // 网络质量提示信息
|
||||
|
||||
// 帧跟踪Map,记录每个提交的帧,key为textureId_frameSeq
|
||||
Map<String, Map<String, dynamic>> frameTracker = {};
|
||||
|
||||
// H264帧缓冲区相关
|
||||
final List<Map<String, dynamic>> h264FrameBuffer = <Map<String, dynamic>>[]; // H264帧缓冲区,存储帧数据和类型
|
||||
int maxFrameBufferSize = 25; // 最大缓冲区大小
|
||||
int targetFps = 25; // 目标解码帧率,只是为了快速填充native的缓冲区
|
||||
final int targetFps = 25; // 目标解码帧率,只是为了快速填充native的缓冲区
|
||||
Timer? frameProcessTimer; // 帧处理定时器
|
||||
bool isProcessingFrame = false; // 是否正在处理帧
|
||||
int lastProcessedTimestamp = 0; // 上次处理帧的时间戳
|
||||
@ -129,7 +125,4 @@ class TalkViewNativeDecodeState {
|
||||
|
||||
// 是否拉伸至全屏
|
||||
RxBool isFullScreen = false.obs;
|
||||
|
||||
//添加监控模式标识
|
||||
final RxBool isMonitoringMode = false.obs;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user