diff --git a/lib/main/lockDetail/monitoring/star_chart_h264/star_chart_logic.dart b/lib/main/lockDetail/monitoring/star_chart_h264/star_chart_logic.dart index 7cc18cbc..f9884a7d 100644 --- a/lib/main/lockDetail/monitoring/star_chart_h264/star_chart_logic.dart +++ b/lib/main/lockDetail/monitoring/star_chart_h264/star_chart_logic.dart @@ -25,6 +25,11 @@ class StarChartLogic extends BaseGetXController { @override void onReady() { super.onReady(); + // 初始化音频播放设备,确保采样率和声道数与 PCM 数据匹配 + FlutterPcmSound.setup(sampleRate: 8000, channelCount: 1); + + // 设置音频数据的供给阈值 + FlutterPcmSound.setFeedThreshold(8000 ~/ 2); // 根据需要调整 _getTalkStatusRefreshUIAction(); _startListenTalkData(); } @@ -72,14 +77,6 @@ class StarChartLogic extends BaseGetXController { Future _playG711Data(List pcmData) async { // 将 PCM 数据转换为 PcmArrayInt16 final PcmArrayInt16 fromList = PcmArrayInt16.fromList(pcmData); - - // 初始化音频播放设备,确保采样率和声道数与 PCM 数据匹配 - await FlutterPcmSound.setup(sampleRate: 8000, channelCount: 1); - - // 设置音频数据的供给阈值 - FlutterPcmSound.setFeedThreshold(8000 ~/ 2); // 根据需要调整 - // final PcmArrayInt16 fromList = PcmArrayInt16.fromList(audioData); - await FlutterPcmSound.feed(fromList); FlutterPcmSound.play(); } diff --git a/lib/talk/startChart/handle/impl/udp_talk_accept_handler.dart b/lib/talk/startChart/handle/impl/udp_talk_accept_handler.dart index 40bfaea3..c29dbc84 100644 --- a/lib/talk/startChart/handle/impl/udp_talk_accept_handler.dart +++ b/lib/talk/startChart/handle/impl/udp_talk_accept_handler.dart @@ -31,12 +31,12 @@ class UdpTalkAcceptHandler extends ScpMessageBaseHandle // 收到同意接听回复 final GenericResp genericResp = scpMessage.Payload; if (checkGenericRespSuccess(genericResp)) { - // 启动发送预期数据请求 - _handleStartSendTalkExpectDataRequest(); Future.delayed(Duration(seconds: 1), () { print('启动定时器判断'); // 启动通话保持定时器 _handleStartTalkPing(); + // 启动发送预期数据请求 + _handleStartSendTalkExpectDataRequest(); // 启动通话数据检查的定时器 _handleCheckTalkDataTimer(); }); diff --git a/lib/talk/startChart/handle/impl/udp_talk_request_handler.dart b/lib/talk/startChart/handle/impl/udp_talk_request_handler.dart index f8f66c23..eb6a0cdd 100644 --- a/lib/talk/startChart/handle/impl/udp_talk_request_handler.dart +++ b/lib/talk/startChart/handle/impl/udp_talk_request_handler.dart @@ -66,8 +66,8 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle Routers.starChartPage, arguments: {'lockId': '111'}, ); - // 触发轻微震动反馈 - HapticFeedback.lightImpact(); + // 触发震动反馈 + HapticFeedback.vibrate(); } // 收到来电请求时进行本地通知 diff --git a/lib/talk/startChart/handle/scp_message_base_handle.dart b/lib/talk/startChart/handle/scp_message_base_handle.dart index 5db47166..1d13809e 100644 --- a/lib/talk/startChart/handle/scp_message_base_handle.dart +++ b/lib/talk/startChart/handle/scp_message_base_handle.dart @@ -33,12 +33,12 @@ class ScpMessageBaseHandle { // 通话保持超时监听定时器管理 final talkePingOverTimeTimerManager = OverTimeTimerManager( - timeoutInSeconds: 5, + timeoutInSeconds: 15, ); // 通话数据超时定时器 final talkDataOverTimeTimerManager = OverTimeTimerManager( - timeoutInSeconds: 3, + timeoutInSeconds: 13, ); // 回复成功消息