fix:调整定时器超时逻辑
This commit is contained in:
parent
63501088e1
commit
13e3839d67
7
lib/talk/startChart/constant/talk_constant.dart
Normal file
7
lib/talk/startChart/constant/talk_constant.dart
Normal file
@ -0,0 +1,7 @@
|
||||
class TalkConstant {
|
||||
// TalkPing 未收到回复超时时间(s)
|
||||
static const int talkePingOverTime = 6;
|
||||
static const int talkeDataOverTime = 6;
|
||||
// 收到TalkRequest 未处理超时时间(s)
|
||||
static const int talkeRequestOverTime = 30;
|
||||
}
|
||||
@ -5,6 +5,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_pcm_sound/flutter_pcm_sound.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/message_type_constant.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/talk_status.dart';
|
||||
import 'package:star_lock/talk/startChart/entity/scp_message.dart';
|
||||
import 'package:star_lock/talk/startChart/handle/scp_message_base_handle.dart';
|
||||
import 'package:star_lock/talk/startChart/handle/scp_message_handle.dart';
|
||||
@ -24,24 +25,26 @@ class UdpTalkAcceptHandler extends ScpMessageBaseHandle
|
||||
|
||||
@override
|
||||
void handleResp(ScpMessage scpMessage) {
|
||||
if (talkStatus.status != TalkStatus.waitingAnswer) {
|
||||
// 如果不是等待接听状态,则不处理
|
||||
return;
|
||||
}
|
||||
// 收到同意接听回复
|
||||
final GenericResp genericResp = scpMessage.Payload;
|
||||
if (checkGenericRespSuccess(genericResp)) {
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
// 启动通话保持定时器
|
||||
_handleStartTalkPing();
|
||||
// 启动发送预期数据请求
|
||||
_handleStartSendTalkExpectDataRequest();
|
||||
// 启动通话数据检查的定时器
|
||||
_handleCheckTalkDataTimer();
|
||||
});
|
||||
// 启动通话保持定时器
|
||||
_handleStartTalkPing();
|
||||
// 启动发送预期数据请求
|
||||
_handleStartSendTalkExpectDataRequest();
|
||||
// 启动通话数据检查的定时器
|
||||
// _handleCheckTalkDataTimer();
|
||||
// 停止播放铃声
|
||||
stopRingtone();
|
||||
// 设置状态为接听成功
|
||||
talkStatus.setAnsweredSuccessfully();
|
||||
// 同意接听之后,停止对讲请求超时监听定时器
|
||||
talkeRequestOverTimeTimerManager.receiveMessage();
|
||||
talkeRequestOverTimeTimerManager.dispose();
|
||||
// // 同意接听之后,停止对讲请求超时监听定时器
|
||||
// talkeRequestOverTimeTimerManager.renewTimer();
|
||||
// talkeRequestOverTimeTimerManager.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,30 +83,13 @@ class UdpTalkAcceptHandler extends ScpMessageBaseHandle
|
||||
// 启动通话保持
|
||||
startChartManage.startTalkPingMessageTimer();
|
||||
// 启动通话保持监听定时器(用来判断如果x秒内没有收到通话保持则执行的操作)
|
||||
talkePingOverTimeTimerManager.startTimer();
|
||||
// 设置通话保持超时后的事件
|
||||
talkePingOverTimeTimerManager.setOnTimeout(() {
|
||||
EasyLoading.showToast('通话异常中断', duration: 2000.milliseconds);
|
||||
// 停止发送通话保持的命令
|
||||
startChartManage.stopTalkPingMessageTimer();
|
||||
startChartManage.stopTalkExpectMessageTimer();
|
||||
talkStatus.setNotTalkPing();
|
||||
talkStatus.setEnd();
|
||||
});
|
||||
talkePingOverTimeTimerManager.start();
|
||||
}
|
||||
|
||||
/// 启动通话数据的检查,判断x秒内是否收到通话数据
|
||||
void _handleCheckTalkDataTimer() {
|
||||
// 启动对讲数据监听定时器
|
||||
talkDataOverTimeTimerManager.startTimer();
|
||||
// 设置对讲数据超时后的事件
|
||||
talkDataOverTimeTimerManager.setOnTimeout(() {
|
||||
EasyLoading.showToast('通话连接失败', duration: 2000.milliseconds);
|
||||
startChartManage.stopTalkPingMessageTimer();
|
||||
startChartManage.stopTalkExpectMessageTimer();
|
||||
talkStatus.setNotTalkData();
|
||||
talkStatus.setEnd();
|
||||
});
|
||||
// 启动通话保持监听定时器(用来判断如果x秒内没有收到通话保持则执行的操作)
|
||||
talkDataOverTimeTimerManager.start();
|
||||
}
|
||||
|
||||
/// 启动发送预期数据请求
|
||||
|
||||
@ -30,7 +30,7 @@ class UdpTalkDataHandler extends ScpMessageBaseHandle
|
||||
@override
|
||||
void handleRealTimeData(ScpMessage scpMessage) {
|
||||
// 收到数据后调用更新,防止定时器超时
|
||||
talkDataOverTimeTimerManager.receiveMessage();
|
||||
// talkDataOverTimeTimerManager.renew();
|
||||
if (scpMessage.Payload != null) {
|
||||
final TalkData talkData = scpMessage.Payload;
|
||||
// 处理音视频数据
|
||||
|
||||
@ -41,8 +41,8 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle
|
||||
stopRingtone();
|
||||
|
||||
// 拒绝接听之后,停止对讲请求超时监听定时器
|
||||
talkeRequestOverTimeTimerManager.receiveMessage();
|
||||
talkeRequestOverTimeTimerManager.dispose();
|
||||
// talkeRequestOverTimeTimerManager.renewTimer();
|
||||
// talkeRequestOverTimeTimerManager.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -13,17 +13,18 @@ class UdpTalkPingHandler extends ScpMessageBaseHandle
|
||||
implements ScpMessageHandler {
|
||||
@override
|
||||
void handleReq(ScpMessage scpMessage) {
|
||||
// TODO: 收到通话保持请求
|
||||
// 收到通话保持请求,回复成功消息
|
||||
replySuccessMessage(scpMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
void handleResp(ScpMessage scpMessage) {
|
||||
// 收到通话保持回复
|
||||
// print('收到通话保持回复');
|
||||
final GenericResp genericResp = scpMessage.Payload;
|
||||
if (checkGenericRespSuccess(genericResp)) {
|
||||
// 收到消息,重新触发定时器
|
||||
talkePingOverTimeTimerManager.receiveMessage();
|
||||
// 收到消息,续签定时器
|
||||
talkePingOverTimeTimerManager.renew();
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +38,7 @@ class UdpTalkPingHandler extends ScpMessageBaseHandle
|
||||
deserializePayload(
|
||||
{required int payloadType,
|
||||
required int messageType,
|
||||
required List<int> byte,
|
||||
required List<int> byte,
|
||||
int? offset,
|
||||
int? PayloadLength,
|
||||
int? spTotal,
|
||||
|
||||
@ -35,8 +35,8 @@ class UdpTalkRejectHandler extends ScpMessageBaseHandle
|
||||
|
||||
|
||||
// 拒绝接听之后,停止对讲请求超时监听定时器
|
||||
talkeRequestOverTimeTimerManager.receiveMessage();
|
||||
talkeRequestOverTimeTimerManager.dispose();
|
||||
// talkeRequestOverTimeTimerManager.renewTimer();
|
||||
// talkeRequestOverTimeTimerManager.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -36,14 +36,14 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle
|
||||
_talkRequestEvent(talkObjectName: talkReq.callerName);
|
||||
|
||||
// 启动对讲请求超时定时器
|
||||
talkeRequestOverTimeTimerManager.startTimer();
|
||||
talkeRequestOverTimeTimerManager.setOnTimeout(() {
|
||||
if (talkStatus.status == TalkStatus.waitingAnswer) {
|
||||
// 超时未接听,发送挂断请求
|
||||
startChartManage.sendTalkRejectMessage();
|
||||
Get.back();
|
||||
}
|
||||
});
|
||||
// talkeRequestOverTimeTimerManager.startTimer();
|
||||
// talkeRequestOverTimeTimerManager.setOnTimeout(() {
|
||||
// if (talkStatus.status == TalkStatus.waitingAnswer) {
|
||||
// // 超时未接听,发送挂断请求
|
||||
// startChartManage.sendTalkRejectMessage();
|
||||
// Get.back();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
import 'dart:async';
|
||||
|
||||
typedef TimeoutCallback = void Function();
|
||||
|
||||
class OverTimeTimerManager {
|
||||
// 构造函数,接受超时时间
|
||||
OverTimeTimerManager({required this.timeoutInSeconds});
|
||||
|
||||
// 定义一个可取消的 Timer
|
||||
Timer? _timer;
|
||||
|
||||
// 超时时间(以秒为单位),是 final 的,因此必须在构造函数中初始化
|
||||
final int timeoutInSeconds;
|
||||
|
||||
// 超时回调函数
|
||||
TimeoutCallback? _onTimeout;
|
||||
|
||||
// 启动计时器
|
||||
void startTimer() {
|
||||
_cancelTimer(); // 取消任何已存在的计时器
|
||||
_timer = Timer(Duration(seconds: timeoutInSeconds), () {
|
||||
// 超时回调方法
|
||||
_onTimeout?.call();
|
||||
// 清除定时器
|
||||
_cancelTimer();
|
||||
});
|
||||
}
|
||||
|
||||
// 接收到消息时调用此方法
|
||||
void receiveMessage() {
|
||||
startTimer();
|
||||
}
|
||||
|
||||
// 设置超时回调函数
|
||||
void setOnTimeout(TimeoutCallback? callback) {
|
||||
_onTimeout = callback;
|
||||
}
|
||||
|
||||
// 取消计时器
|
||||
void _cancelTimer() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
}
|
||||
|
||||
// 清理资源
|
||||
void dispose() {
|
||||
_cancelTimer();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/talk_constant.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/talk_status.dart';
|
||||
import 'package:star_lock/talk/startChart/start_chart_manage.dart';
|
||||
import 'package:star_lock/talk/startChart/start_chart_talk_status.dart';
|
||||
|
||||
class TalkDataOverTimeTimerManager {
|
||||
// 单例实例
|
||||
static final TalkDataOverTimeTimerManager _instance =
|
||||
TalkDataOverTimeTimerManager._internal();
|
||||
|
||||
factory TalkDataOverTimeTimerManager() => _instance;
|
||||
|
||||
// 获取 StartChartTalkStatus 的唯一实例
|
||||
static StartChartTalkStatus talkStatus = StartChartTalkStatus.instance;
|
||||
final Duration timeout;
|
||||
final void Function() onTimeout;
|
||||
Timer? _timer;
|
||||
|
||||
// 私有构造函数
|
||||
TalkDataOverTimeTimerManager._internal()
|
||||
: timeout = const Duration(seconds: TalkConstant.talkeDataOverTime),
|
||||
onTimeout = _handleTalkeDataOverTime;
|
||||
|
||||
// 超时处理函数
|
||||
static void _handleTalkeDataOverTime() {
|
||||
EasyLoading.showToast('通话连接失败', duration: 2000.milliseconds);
|
||||
StartChartManage().stopTalkPingMessageTimer();
|
||||
StartChartManage().stopTalkExpectMessageTimer();
|
||||
talkStatus.setNotTalkData();
|
||||
talkStatus.setEnd();
|
||||
}
|
||||
|
||||
// 启动定时器
|
||||
void start() {
|
||||
_timer = Timer(timeout, onTimeout);
|
||||
}
|
||||
|
||||
// 续签定时器
|
||||
void renew() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
start();
|
||||
}
|
||||
|
||||
// 取消定时器
|
||||
void cancel() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/talk_constant.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/talk_status.dart';
|
||||
import 'package:star_lock/talk/startChart/start_chart_manage.dart';
|
||||
import 'package:star_lock/talk/startChart/start_chart_talk_status.dart';
|
||||
|
||||
class TalkePingOverTimeTimerManager {
|
||||
// 单例实例
|
||||
static final TalkePingOverTimeTimerManager _instance =
|
||||
TalkePingOverTimeTimerManager._internal();
|
||||
|
||||
factory TalkePingOverTimeTimerManager() => _instance;
|
||||
|
||||
// 获取 StartChartTalkStatus 的唯一实例
|
||||
static StartChartTalkStatus talkStatus = StartChartTalkStatus.instance;
|
||||
final Duration timeout;
|
||||
final void Function() onTimeout;
|
||||
Timer? _timer;
|
||||
|
||||
// 私有构造函数
|
||||
TalkePingOverTimeTimerManager._internal()
|
||||
: timeout = const Duration(seconds: TalkConstant.talkePingOverTime),
|
||||
onTimeout = _handleTalkePingOverTime;
|
||||
|
||||
// 超时处理函数
|
||||
static void _handleTalkePingOverTime() {
|
||||
if (talkStatus.status == TalkStatus.duringCall) {
|
||||
EasyLoading.showToast('通话异常中断', duration: 2000.milliseconds);
|
||||
// 停止发送通话保持的命令
|
||||
StartChartManage().stopTalkPingMessageTimer();
|
||||
StartChartManage().stopTalkExpectMessageTimer();
|
||||
// 如果通话异常,则发送通话中挂断
|
||||
StartChartManage().sendTalkHangupMessage();
|
||||
talkStatus.setNotTalkPing();
|
||||
talkStatus.setEnd();
|
||||
}
|
||||
}
|
||||
|
||||
// 启动定时器
|
||||
void start() {
|
||||
_timer = Timer(timeout, onTimeout);
|
||||
}
|
||||
|
||||
// 续签定时器
|
||||
void renew() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
start();
|
||||
}
|
||||
|
||||
// 取消定时器
|
||||
void cancel() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/talk_constant.dart';
|
||||
import 'package:star_lock/talk/startChart/constant/talk_status.dart';
|
||||
import 'package:star_lock/talk/startChart/start_chart_manage.dart';
|
||||
import 'package:star_lock/talk/startChart/start_chart_talk_status.dart';
|
||||
|
||||
class TalkeRequestOverTimeTimerManager {
|
||||
// 单例实例
|
||||
static final TalkeRequestOverTimeTimerManager _instance =
|
||||
TalkeRequestOverTimeTimerManager._internal();
|
||||
|
||||
factory TalkeRequestOverTimeTimerManager() => _instance;
|
||||
|
||||
// 获取 StartChartTalkStatus 的唯一实例
|
||||
static StartChartTalkStatus talkStatus = StartChartTalkStatus.instance;
|
||||
final Duration timeout;
|
||||
final void Function() onTimeout;
|
||||
Timer? _timer;
|
||||
|
||||
// 私有构造函数
|
||||
TalkeRequestOverTimeTimerManager._internal()
|
||||
: timeout = const Duration(seconds: TalkConstant.talkeRequestOverTime),
|
||||
onTimeout = _handleTalkeRequestOverTime;
|
||||
|
||||
// 超时处理函数
|
||||
static void _handleTalkeRequestOverTime() {
|
||||
if (talkStatus.status == TalkStatus.waitingAnswer) {
|
||||
// 超时未接听,发送挂断请求
|
||||
StartChartManage().sendTalkRejectMessage();
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
|
||||
// 启动定时器
|
||||
void start() {
|
||||
_timer = Timer(timeout, onTimeout);
|
||||
}
|
||||
|
||||
// 续签定时器
|
||||
void renew() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
start();
|
||||
}
|
||||
|
||||
// 取消定时器
|
||||
void cancel() {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
@ -3,15 +3,21 @@ import 'dart:convert';
|
||||
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/startChart/constant/payload_type_constant.dart';
|
||||
|
||||
import 'package:star_lock/talk/startChart/constant/udp_constant.dart';
|
||||
import 'package:star_lock/talk/startChart/entity/scp_message.dart';
|
||||
import 'package:star_lock/talk/startChart/handle/other/overtime_timer_manger.dart';
|
||||
|
||||
import 'package:star_lock/talk/startChart/handle/other/talk_data_repository.dart';
|
||||
import 'package:star_lock/talk/startChart/handle/other/talke_data_over_time_timer_manager.dart';
|
||||
import 'package:star_lock/talk/startChart/handle/other/talke_ping_over_time_timer_manager.dart';
|
||||
import 'package:star_lock/talk/startChart/handle/other/talke_request_over_time_timer_manager.dart';
|
||||
|
||||
import 'package:star_lock/talk/startChart/proto/generic.pb.dart';
|
||||
import 'package:star_lock/talk/startChart/proto/talk_data.pb.dart';
|
||||
@ -19,8 +25,16 @@ import 'package:star_lock/talk/startChart/start_chart_manage.dart';
|
||||
import 'package:star_lock/talk/startChart/start_chart_talk_status.dart';
|
||||
|
||||
class ScpMessageBaseHandle {
|
||||
/// 使用单例 TimerManager
|
||||
/// 超时处理
|
||||
final TalkeRequestOverTimeTimerManager talkeRequestOverTimeTimerManager =
|
||||
TalkeRequestOverTimeTimerManager();
|
||||
final TalkePingOverTimeTimerManager talkePingOverTimeTimerManager =
|
||||
TalkePingOverTimeTimerManager();
|
||||
final TalkDataOverTimeTimerManager talkDataOverTimeTimerManager =
|
||||
TalkDataOverTimeTimerManager();
|
||||
|
||||
final startChartManage = StartChartManage();
|
||||
final List<int> _buffer = [];
|
||||
|
||||
/// 分包缓冲区
|
||||
// 存储每个 messageId 对应的分包数据
|
||||
@ -36,21 +50,6 @@ class ScpMessageBaseHandle {
|
||||
|
||||
final audioManager = AudioPlayerManager();
|
||||
|
||||
// 通话请求超时未处理监听定时器管理
|
||||
final talkeRequestOverTimeTimerManager = OverTimeTimerManager(
|
||||
timeoutInSeconds: 8,
|
||||
);
|
||||
|
||||
// 通话保持超时监听定时器管理
|
||||
final talkePingOverTimeTimerManager = OverTimeTimerManager(
|
||||
timeoutInSeconds: 5,
|
||||
);
|
||||
|
||||
// 通话数据超时定时器
|
||||
final talkDataOverTimeTimerManager = OverTimeTimerManager(
|
||||
timeoutInSeconds: 30,
|
||||
);
|
||||
|
||||
// 回复成功消息
|
||||
void replySuccessMessage(ScpMessage scpMessage) {
|
||||
startChartManage.sendGenericRespSuccessMessage(
|
||||
@ -142,4 +141,11 @@ class ScpMessageBaseHandle {
|
||||
_packetBuffer.remove(key);
|
||||
_packetTimers.remove(key)?.cancel();
|
||||
}
|
||||
|
||||
// 处理通话请求未处理超时
|
||||
void _handleTalkeRequestOverTime() {}
|
||||
|
||||
void _handleTalkePingOverTime() {}
|
||||
|
||||
void _handleTalkDataOverTime() {}
|
||||
}
|
||||
|
||||
@ -451,7 +451,7 @@ class StartChartManage {
|
||||
MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: true),
|
||||
);
|
||||
await _sendMessage(message: message);
|
||||
_log(text: '发送通话保持');
|
||||
// _log(text: '发送通话保持');
|
||||
}
|
||||
|
||||
// 发送通话中挂断消息
|
||||
|
||||
@ -30,13 +30,14 @@ import '../../../../tools/baseGetXController.dart';
|
||||
class TalkViewLogic extends BaseGetXController {
|
||||
final TalkViewState state = TalkViewState();
|
||||
|
||||
Timer? _syncTimer;
|
||||
int _startTime = 0;
|
||||
final int bufferSize = 20; // 缓冲区大小(以帧为单位)
|
||||
Timer? _syncTimer; // 音视频播放刷新率定时器
|
||||
int _startTime = 0; // 开始播放时间戳,用于判断帧数据中的时间戳位置
|
||||
final int bufferSize = 8; // 缓冲区大小(以帧为单位)
|
||||
final List<int> frameTimestamps = []; // 帧时间戳用于计算 FPS
|
||||
int frameIntervalMs = 45; // 初始帧间隔设置为45毫秒(约22FPS)
|
||||
int minFrameIntervalMs = 30; // 最小帧间隔(约33 FPS)
|
||||
int maxFrameIntervalMs = 100; // 最大帧间隔(约10 FPS)
|
||||
int maxFrameIntervalMs = 500; // 最大帧间隔(约2 FPS)
|
||||
// int maxFrameIntervalMs = 100; // 最大帧间隔(约10 FPS)
|
||||
|
||||
/// 初始化音频播放器
|
||||
void _initFlutterPcmSound() {
|
||||
@ -82,7 +83,7 @@ class TalkViewLogic extends BaseGetXController {
|
||||
|
||||
// 监听音视频数据流
|
||||
void _startListenTalkData() {
|
||||
state.talkDataRepository.talkDataStream.listen((talkData) {
|
||||
state.talkDataRepository.talkDataStream.listen((TalkData talkData) {
|
||||
final contentType = talkData.contentType;
|
||||
final currentTimestamp = DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
@ -97,11 +98,14 @@ class TalkViewLogic extends BaseGetXController {
|
||||
if (state.audioBuffer.length < bufferSize) {
|
||||
state.audioBuffer.add(talkData);
|
||||
}
|
||||
// print('收到音频数据');
|
||||
|
||||
break;
|
||||
case TalkData_ContentTypeE.Image:
|
||||
if (state.videoBuffer.length < bufferSize) {
|
||||
state.videoBuffer.add(talkData);
|
||||
}
|
||||
print('talkData durationMs-->:${talkData.durationMs}');
|
||||
|
||||
/// 更新网络状态
|
||||
updateNetworkStatus(currentTimestamp);
|
||||
@ -257,7 +261,6 @@ class TalkViewLogic extends BaseGetXController {
|
||||
} else {
|
||||
state.networkStatus.value = NetworkStatus.normal;
|
||||
state.alertCount.value = 0; // 重置计数器
|
||||
EasyLoading.dismiss(); // 网络恢复正常时关闭提示
|
||||
}
|
||||
}
|
||||
state.lastFrameTimestamp.value = currentTimestamp;
|
||||
@ -340,6 +343,7 @@ class TalkViewLogic extends BaseGetXController {
|
||||
_stopPlayG711Data();
|
||||
state.listData.value = Uint8List(0);
|
||||
_syncTimer?.cancel();
|
||||
_syncTimer = null;
|
||||
}
|
||||
|
||||
/// 处理无效通话状态
|
||||
|
||||
@ -199,8 +199,10 @@ class _TalkViewPageState extends State<TalkViewPage>
|
||||
if (state.talkStatus.value == TalkStatus.duringCall) {
|
||||
if (state.isRecordingScreen.value) {
|
||||
await logic.stopRecording();
|
||||
print('停止录屏');
|
||||
} else {
|
||||
await logic.startRecording();
|
||||
print('开始录屏');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user