fix:补充测试代码
This commit is contained in:
parent
a029c4b4e0
commit
006af6e751
@ -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<void> _playG711Data(List<int> 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();
|
||||
}
|
||||
|
||||
@ -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();
|
||||
});
|
||||
|
||||
@ -66,8 +66,8 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle
|
||||
Routers.starChartPage,
|
||||
arguments: <String, String>{'lockId': '111'},
|
||||
);
|
||||
// 触发轻微震动反馈
|
||||
HapticFeedback.lightImpact();
|
||||
// 触发震动反馈
|
||||
HapticFeedback.vibrate();
|
||||
}
|
||||
|
||||
// 收到来电请求时进行本地通知
|
||||
|
||||
@ -33,12 +33,12 @@ class ScpMessageBaseHandle {
|
||||
|
||||
// 通话保持超时监听定时器管理
|
||||
final talkePingOverTimeTimerManager = OverTimeTimerManager(
|
||||
timeoutInSeconds: 5,
|
||||
timeoutInSeconds: 15,
|
||||
);
|
||||
|
||||
// 通话数据超时定时器
|
||||
final talkDataOverTimeTimerManager = OverTimeTimerManager(
|
||||
timeoutInSeconds: 3,
|
||||
timeoutInSeconds: 13,
|
||||
);
|
||||
|
||||
// 回复成功消息
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user