1.优化鸿蒙手机监控/视频对讲动画转动问题

This commit is contained in:
sky.min 2025-12-29 08:57:36 +08:00
parent ae62d3f820
commit 9a76dcd232
3 changed files with 11 additions and 34 deletions

View File

@ -50,6 +50,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
@override
void initState() {
super.initState();
print("LockDetailPage initState");
state.animationController = AnimationController(duration: const Duration(seconds: 1), vsync: this);
state.animationController?.repeat();
@ -63,7 +64,6 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
state.animationController?.forward();
}
});
super.initState();
state.pageController.addListener(() {
state.currentPage.value = state.pageController.page!.round();

View File

@ -239,14 +239,7 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
//
VideoDecodePlugin.setOnFrameRenderedListener((textureId) {
AppLog.log('已经开始渲染=======');
// loading
Future.microtask(() {
state.isLoading.value = false;
//
if (state.animationController.isAnimating) {
state.animationController.stop();
}
});
Future.microtask(() => state.isLoading.value = false);
});
} else {
AppLog.log('视频解码器初始化失败或超时, 耗时: ${duration}ms');
@ -588,7 +581,6 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
/// -
Future<void> _processNextFrameFromBuffer() async {
final stopwatch = Stopwatch()..start();
_monitorFrameProcessingPerformance();
final startTime = DateTime.now().microsecondsSinceEpoch;
@ -774,8 +766,6 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
AppLog.log('帧处理耗时过长: ${durationMs.toStringAsFixed(2)} ms, 缓冲区长度: ${state.h264FrameBuffer.length}');
}
}
stopwatch.stop();
print('执行耗时: ${stopwatch.elapsedMilliseconds} 毫秒');
}

View File

@ -39,32 +39,23 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
final TalkViewNativeDecodeState state = Get.find<TalkViewNativeDecodeLogic>().state;
final startChartManage = StartChartManage();
late AnimationController _animationController; //
@override
void initState() {
super.initState();
_animationController = AnimationController( // 使
vsync: this,
state.animationController = AnimationController(
vsync: this, // 使TickerProvider是当前Widget
duration: const Duration(seconds: 1),
);
state.animationController = _animationController; //
_animationController.repeat();
SchedulerBinding.instance.addPostFrameCallback((_) {
_animationController.duration = const Duration(milliseconds: 500);
});
_animationController.addStatusListener((AnimationStatus status) {
state.animationController.repeat();
//StatusListener
state.animationController.addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) {
_animationController.reset();
_animationController.forward();
state.animationController.reset();
state.animationController.forward();
} else if (status == AnimationStatus.dismissed) {
_animationController.reset();
_animationController.forward();
state.animationController.reset();
state.animationController.forward();
}
});
}
@ -521,10 +512,6 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage> wit
@override
void dispose() {
CallTalk().finishAVData();
// animation controller
_animationController.dispose();
super.dispose();
}
}