From 2a9ff10eae892627b2f5bc84fee9016d7adfb776 Mon Sep 17 00:00:00 2001 From: open-trade Date: Thu, 26 Nov 2020 22:48:15 +0800 Subject: [PATCH] fix on close alert in loading --- flutter_hbb/lib/common.dart | 2 +- flutter_hbb/lib/model.dart | 6 ++++-- flutter_hbb/lib/remote_page.dart | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/flutter_hbb/lib/common.dart b/flutter_hbb/lib/common.dart index cf07bdf6f..0aa15cdf0 100644 --- a/flutter_hbb/lib/common.dart +++ b/flutter_hbb/lib/common.dart @@ -14,7 +14,7 @@ class MyTheme { } void showLoading(String text, BuildContext context) { - if (_hasDialog) { + if (_hasDialog && context != null) { Navigator.pop(context); } dismissLoading(); diff --git a/flutter_hbb/lib/model.dart b/flutter_hbb/lib/model.dart index b3ef083c1..cfc937e3c 100644 --- a/flutter_hbb/lib/model.dart +++ b/flutter_hbb/lib/model.dart @@ -100,10 +100,12 @@ class FfiModel with ChangeNotifier { } else if (name == "audio_format") { try { var s = int.parse(evt['sample_rate']); - var c = int.parse(evt['channels']); + // var c = int.parse(evt['channels']); + // Flutter Sound does not support Floating Point PCM data, nor records with more that one audio channel. + // On Flutter Sound, Raw PCM is only PCM INT-Linerar 16 monophony await stopAudio(); await _audioPlayer.startPlayerFromStream( - codec: Codec.opusWebM, numChannels: c, sampleRate: s); + codec: Codec.pcm16, numChannels: 1, sampleRate: s); } catch (e) { print('audio_format: $e'); } diff --git a/flutter_hbb/lib/remote_page.dart b/flutter_hbb/lib/remote_page.dart index 641c5fddb..6b361e85b 100644 --- a/flutter_hbb/lib/remote_page.dart +++ b/flutter_hbb/lib/remote_page.dart @@ -530,7 +530,7 @@ void enterPasswordDialog(String id, BuildContext context) { var text = controller.text.trim(); if (text == '') return; FFI.login(text, remember); - showLoading('Logging in...', context); + showLoading('Logging in...', null); Navigator.pop(context); }, child: Text('OK'),