刚刚发布的音频pugin在扑腾



我正在做一个项目,当用户点击按钮时,计时器将启动,在用户设置的时间后,将播放一个声音,因为我在我的flutter项目中使用了just_audio: ^0.6.15+1,但它导致了许多问题,下面是错误。

D/Linux   (21303): [Posix_connect Debug]Process com.snss.xlnc :443 
E/flutter (21303): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Connection aborted
E/flutter (21303): #0      AudioPlayer._load (package:just_audio/just_audio.dart:688:11)
E/flutter (21303): <asynchronous suspension>
E/flutter (21303): #1      AudioPlayer.load (package:just_audio/just_audio.dart:625:14)
E/flutter (21303): <asynchronous suspension>
E/flutter (21303): #2      AudioPlayer.setAudioSource (package:just_audio/just_audio.dart:602:18)
E/flutter (21303): <asynchronous suspension>
E/flutter (21303): #3      _ClassStartState.keepRunning (package:xlnc/tutor/startClass.dart:84:7)
E/flutter (21303): <asynchronous suspension>
E/flutter (21303): 

这是我的代码

var t = DateFormat.Hms().parse(time);
var rT = DateFormat.Hms().parse(remTime);
var co = t.isAfter(rT);
if (co) {
player.setUrl('$soundUrl');
player.setVolume(1);
player.play();
player.setLoopMode(LoopMode.one);
}

这是我的扑动医生-v

[√] Flutter (Channel stable, 2.0.1, on Microsoft Windows [Version 10.0.19042.804], locale en-IN)
• Flutter version 2.0.1 at D:flutter
• Framework revision c5a4b4029c (7 days ago), 2021-03-04 09:47:48 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at D:android_sdk
• Platform android-S, build-tools 30.0.3
• ANDROID_HOME = D:android_sdk
• Java binary at: C:Program FilesAndroidAndroid Studiojrebinjava
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:Program FilesGoogleChromeApplicationchrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:Program FilesAndroidAndroid Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.54.1)
• VS Code at C:UsersuserAppDataLocalProgramsMicrosoft VS Code
• Flutter extension version 3.20.0
[√] Connected device (3 available)
• vivo 1907 (mobile) • SOFAE6TCEMRKFUCU • android-arm64  • Android 10 (API 29)
• Chrome (web)       • chrome           • web-javascript • Google Chrome 89.0.4389.82
• Edge (web)         • edge             • web-javascript • Microsoft Edge 88.0.705.81
• No issues found!

首先访问AndroidManifest.xml。它可以在/android/app/src/main中找到。

然后只需在<application标签下添加android:usesCleartextTraffic="true"

你的AndroidManifest.xml在下面应该是这样的

<application
android:name="io.flutter.app.FlutterApplication"
android:label="shafa_doctor"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true" //just add this line only
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
... more code belows

相关内容

  • 没有找到相关文章