gpt4 book ai didi

android - flutter 中just_audio pugin的问题

转载 作者:行者123 更新时间:2023-12-04 23:54:56 24 4
gpt4 key购买 nike

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

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);
}
这是我的 flutter 医生-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 Files\Android\Android Studio\jre\bin\java
• 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 Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android 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:\Users\user\AppData\Local\Programs\Microsoft 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 中找到。
然后只需添加 android:usesCleartextTraffic="true"<application 下标签。
您的 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

关于android - flutter 中just_audio pugin的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66580270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com