How to play music in flutter from github? - flutter

Suppose you have a mp3 on github and want to play it with flutter..how will you play it?
Nothing is working in my case. I'm importing AudioPlayers version audioplayers: ^0.20.1 in pubsec.yaml
import 'package:audioplayers/audioplayers.dart';
final player = AudioPlayer(mode: PlayerMode.MEDIA_PLAYER);
// player.play(music_Url);
player.setUrl(music_Url);
//Tried using both ways but no luck. Can Anyone knows how to do it?
///Error I'm receiving
V/MediaHTTPService( 3988): MediaHTTPService(android.media.MediaHTTPService#dede1fd): Cookies: wenull
V/MediaHTTPService( 3988): makeHTTPConnection: CookieManager created: java.net.CookieManager#fd27ef2
V/MediaHTTPService( 3988): makeHTTPConnection(android.media.MediaHTTPService#dede1fd): cookieHandler: java.net.CookieManager#fd27ef2 Cookies: null
W/System ( 3988): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out( 3988): [okhttp] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/System.out( 3988): [socket]:check permission begin!
W/System ( 3988): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out( 3988): [socket] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/System.out( 3988): [OkHttp] sendRequest>>
I/System.out( 3988): [OkHttp] sendRequest<<
E/MediaPlayerNative( 3988): error (1, -2147483648)
E/MediaPlayer( 3988): Error (1,-2147483648)
V/MediaPlayer( 3988): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer( 3988): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer( 3988): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer( 3988): cleanDrmObj: mDrmObj=null mDrmSessionId=null
D/MediaPlayer( 3988): _release native called
D/MediaPlayer( 3988): _release native finished
W/System ( 3988): A resource failed to call end.

Related

error when using better player in flutter

E/MethodChannel#better_player_channel: Failed to handle method call
java.lang.NullPointerException: MediaSource.Factory#setDrmSessionManagerProvider no longer handles null by instantiating a new DefaultDrmSessionManagerProvider. Explicitly construct and pass an instance in order to retain the old behavior.
at com.google.android.exoplayer2.util.Assertions.checkNotNull(Assertions.java:174)
at com.google.android.exoplayer2.source.ProgressiveMediaSource$Factory.setDrmSessionManagerProvider(ProgressiveMediaSource.java:186)
at com.jhomlala.better_player.BetterPlayer.buildMediaSource(BetterPlayer.kt:430)
at com.jhomlala.better_player.BetterPlayer.setDataSource(BetterPlayer.kt:196)
at com.jhomlala.better_player.BetterPlayerPlugin.setDataSource(BetterPlayerPlugin.kt:277)
at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:151)
at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:138)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
E/flutter: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, MediaSource.Factory#setDrmSessionManagerProvider no longer handles null by instantiating a new DefaultDrmSessionManagerProvider. Explicitly construct and pass an instance in order to retain the old behavior., null, java.lang.NullPointerException: MediaSource.Factory#setDrmSessionManagerProvider no longer handles null by instantiating a new DefaultDrmSessionManagerProvider. Explicitly construct and pass an instance in order to retain the old behavior.
at com.google.android.exoplayer2.util.Assertions.checkNotNull(Assertions.java:174)
at com.google.android.exoplayer2.source.ProgressiveMediaSource$Factory.setDrmSessionManagerProvider(ProgressiveMediaSource.java:186)
at com.jhomlala.better_player.BetterPlayer.buildMediaSource(BetterPlayer.kt:430)
at com.jhomlala.better_player.BetterPlayer.setDataSource(BetterPlayer.kt:196)
at com.jhomlala.better_player.BetterPlayerPlugin.setDataSource(BetterPlayerPlugin.kt:277)
at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:151)
at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:138)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
#2 MethodChannelVideoPlayer.setDataSource (package:better_player/src/video_player/method_channel_video_player.dart:118:5)
#3 VideoPlayerController._setDataSource (package:better_player/src/video_player/video_player.dart:408:5)
#4 BetterPlayerController._setupDataSource (package:better_player/src/core/better_player_controller.dart:444:9)
#5 BetterPlayerController.setupDataSource (package:better_player/src/core/better_player_controller.dart:274:5)
I face this problem when I use better_player in flutter, It was work good but now show this problem .
Any one can help me

I am Working on Flutter Foreground task facing an issue of not running code which i have worked can any one help me out to under stand problem

basically i am working on voice application which takes an input as voice and convert voice into text if any command like hello received it will resond with an answer in voice
i have used packages
flutter tts
flutter speach
for foreground i have used
https://medium.com/#burlakovv.ivan/simple-android-foreground-service-in-flutter-for-non-kotlin-developers-31607909a633
here is out put of console
I/flutter ( 2692): AppLifecycleState----------------------------------state: AppLifecycleState.inactive
E/eglCodecCommon( 2692): goldfish_dma_create_region: could not obtain fd to device! fd -1 errno=2
I/flutter ( 2692): AppLifecycleState----------------------------------state: AppLifecycleState.paused
I/flutter ( 2692): AppLifecycleState----------------------------------state: AppLifecycleState.detached
I/flutter ( 2692): false
I/flutter ( 2692): _MyAppState.activateSpeechRecognizer...
W/TextToSpeech( 2692): stop failed: not bound to TTS engine
W/TextToSpeech( 2692): shutdown failed: not bound to TTS engine
I/flutter ( 2692): Marco Has been Found++++++++++++++++++++++++++++++
D/FlutterSpeechPlugin( 2692): Current Locale : en_US
E/MethodChannel#com.flutter.speech_recognition( 2692): Failed to handle method call
E/MethodChannel#com.flutter.speech_recognition( 2692): java.lang.NullPointerException: Attempt to invoke interface method 'android.app.Activity io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding.getActivity()' on a null object reference
E/MethodChannel#com.flutter.speech_recognition( 2692): at com.flutter.speech_recognition.flutter_speech.FlutterSpeechRecognitionPlugin.onMethodCall(FlutterSpeechRecognitionPlugin.java:52)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:319)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.os.Looper.loop(Looper.java:214)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#com.flutter.speech_recognition( 2692): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.flutter.speech_recognition( 2692): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#com.flutter.speech_recognition( 2692): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
W/FlutterJNI( 2692): Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: 15
I/Choreographer( 2692): Skipped 269 frames! The application may be doing too much work on its main thread.
E/MethodChannel#com.flutter.speech_recognition( 2692): Failed to handle method call
E/MethodChannel#com.flutter.speech_recognition( 2692): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.speech.SpeechRecognizer.stopListening()' on a null object reference
E/MethodChannel#com.flutter.speech_recognition( 2692): at com.flutter.speech_recognition.flutter_speech.FlutterSpeechRecognitionPlugin.onMethodCall(FlutterSpeechRecognitionPlugin.java:75)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:319)
E/MethodChannel#com.flutter.speech_recognition( 2692): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.os.Looper.loop(Looper.java:214)
E/MethodChannel#com.flutter.speech_recognition( 2692): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#com.flutter.speech_recognition( 2692): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.flutter.speech_recognition( 2692): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#com.flutter.speech_recognition( 2692): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
W/FlutterJNI( 2692): Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: 16

assets_audio_player Crash after wrong url

Is work when the URL is available, the problem is when URL down make a long time ~1min to start another media.
I try to exit the Future after 4 seconds that print the warning and the app stay frozen
for ~1 min.
How I can handle this exception and avoid stopping the application?
Future<void> selectStation(Station item) async {
Future.delayed(const Duration(milliseconds: 500), () async {
try {
await _assetsAudioPlayer.open(Audio.liveStream(
item.url,
));
//_assetsAudioPlayer.onErrorDo = (handler) {
// handler.player.stop();
//};
} catch (e) {
await _assetsAudioPlayer.stop();
return;
}
}).timeout(Duration(seconds: 4), onTimeout: () async {
await _assetsAudioPlayer.stop();
CoolAlert.show(
context: context,
type: CoolAlertType.error,
text:
"the station ${item.title} is no available, try later <timeout>!",
);
return;
});
}
log flutter :
W/MediaPlayer( 7297): Couldn't open https://test.tt/media.mp3
W/MediaPlayer( 7297): java.io.FileNotFoundException: No content provider: https://test.tt/media.mp3
W/MediaPlayer( 7297): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1690)
W/MediaPlayer( 7297): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1520)
W/MediaPlayer( 7297): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1437)
W/MediaPlayer( 7297): at android.media.MediaPlayer.attemptDataSource(MediaPlayer.java:1174)
W/MediaPlayer( 7297): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1146)
W/MediaPlayer( 7297): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1170)
W/MediaPlayer( 7297): at com.github.florent37.assets_audio_player.playerimplem.PlayerImplemMediaPlayer$open$2.invokeSuspend(PlayerImplemMediaPlayer.kt:129)
W/MediaPlayer( 7297): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/MediaPlayer( 7297): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/MediaPlayer( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
W/MediaPlayer( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
W/MediaPlayer( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
W/MediaPlayer( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I/OppoMediaPlayer( 7297): setDataSource(path, headers) isOppoCreate=false
V/MediaHTTPService( 7297): MediaHTTPService(android.media.MediaHTTPService#ddd12ca): Cookies: null
I/OppoMediaPlayer( 7297): prepare() isOppoCreate=false
V/MediaHTTPService( 7297): makeHTTPConnection: CookieManager created: java.net.CookieManager#516bc3b
V/MediaHTTPService( 7297): makeHTTPConnection(android.media.MediaHTTPService#ddd12ca): cookieHandler: java.net.CookieManager#516bc3b Cookies: null
E/MediaPlayerNative( 7297): error (1, -2147483648)
W/System.err( 7297): java.io.IOException: Prepare failed.: status=0x1
W/System.err( 7297): at android.media.MediaPlayer._prepare(Native Method)
W/System.err( 7297): at android.media.MediaPlayer.prepare(MediaPlayer.java:1414)
W/System.err( 7297): at com.github.florent37.assets_audio_player.playerimplem.PlayerImplemMediaPlayer$open$2.invokeSuspend(PlayerImplemMediaPlayer.kt:185)
W/System.err( 7297): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err( 7297): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/System.err( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
W/System.err( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
W/System.err( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
W/System.err( 7297): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
I/OppoMediaPlayer( 7297): handleMediaPlayerError() mCurrentState=4
I/OppoMediaPlayer( 7297): handleMediaPlayerError() mNotUsingOppoMedia is true
I/MediaPlayer( 7297): prepare failed ,throw IOException to app
I/OppoMediaPlayer( 7297): release() isOppoCreate =false
D/OppoMediaPlayer( 7297): closeFd()
V/MediaPlayer( 7297): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer( 7297): cleanDrmObj: mDrmObj=null mDrmSessionId=null
D/MediaPlayer( 7297): _release native called
D/MediaPlayer( 7297): _release native finished
W/System.err( 7297): com.github.florent37.assets_audio_player.playerimplem.PlayerFinder$NoPlayerFoundException
W/System.err( 7297): at com.github.florent37.assets_audio_player.playerimplem.PlayerFinder._findWorkingPlayer(PlayerFinder.kt:70)
W/System.err( 7297): at com.github.florent37.assets_audio_player.playerimplem.PlayerFinder._findWorkingPlayer(PlayerFinder.kt:88)
W/System.err( 7297): at com.github.florent37.assets_audio_player.playerimplem.PlayerFinder$_findWorkingPlayer$1.invokeSuspend(Unknown Source:12)
W/System.err( 7297): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err( 7297): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
W/System.err( 7297): at android.os.Handler.handleCallback(Handler.java:883)
W/System.err( 7297): at android.os.Handler.dispatchMessage(Handler.java:100)
W/System.err( 7297): at android.os.Looper.loop(Looper.java:237)
W/System.err( 7297): at android.app.ActivityThread.main(ActivityThread.java:7830)
W/System.err( 7297): at java.lang.reflect.Method.invoke(Native Method)
W/System.err( 7297): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/System.err( 7297): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)
I/flutter ( 7297): PlatformException(OPEN, null, null, null)
Any help is welcome.
Player crashes when track file in invalid instead of giving some message.
https://github.com/florent37/Flutter-AssetsAudioPlayer/issues/627
I change the plugin.

how to solve FATAL EXCEPTION: AsyncTask #2 in flutter

I am using video_editor package in flutter. When I at debug mode it works and no error but when I release the apk, the apps clash and show the error :
D/flutter-ffmpeg(10753): Getting media information for /data/user/0/com.example.apps/cache/file_picker/Screenrecorder-2021-05-19-15-53-57-515.mp4.
E/AndroidRuntime(10753): FATAL EXCEPTION: AsyncTask #2
E/AndroidRuntime(10753): Process: com.example.apps, PID: 10753
E/AndroidRuntime(10753): java.lang.RuntimeException: An error occurred while executing doInBackground()
E/AndroidRuntime(10753): at android.os.AsyncTask$4.done(AsyncTask.java:399)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.run(FutureTask.java:271)
E/AndroidRuntime(10753): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(10753): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(10753): at java.lang.Thread.run(Thread.java:919)
E/AndroidRuntime(10753): Caused by: java.lang.UnsatisfiedLinkError: Bad JNI version returned from JNI_OnLoad in "/data/app/com.example.apps-QO20kuBv0uYvExYVArrO7A==/lib/arm64/libmobileffmpeg.so": 0
E/AndroidRuntime(10753): at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
E/AndroidRuntime(10753): at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
E/AndroidRuntime(10753): at java.lang.System.loadLibrary(System.java:1667)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.Config.<clinit>(Unknown Source:148)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.Config.nativeFFprobeExecute(Native Method)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.f.a(Unknown Source:0)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.f.b(Unknown Source:0)
E/AndroidRuntime(10753): at com.arthenica.mobileffmpeg.f.a(Unknown Source:48)
E/AndroidRuntime(10753): at c.b.a.a.c.a(Unknown Source:21)
E/AndroidRuntime(10753): at c.b.a.a.c.doInBackground(Unknown Source:2)
E/AndroidRuntime(10753): at android.os.AsyncTask$3.call(AsyncTask.java:378)
E/AndroidRuntime(10753): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/AndroidRuntime(10753): ... 3 more
Does anyone know how to solve this error?
Please check that all required dependencies are included within "dependencies:" in pubspec.yaml. Dependencies declared inside "dev_dependencies:" are not included in released app
Add the following entries into your proguard-rules.pro file. If you don't have this file you can create and put in app folder.
-keep class com.arthenica.mobileffmpeg.Config {
native <methods>;
void log(long, int, byte[]);
void statistics(long, int, float, float, long , int, double, double);
}
-keep class com.arthenica.mobileffmpeg.AbiDetect {
native <methods>;
}

Invalid Datasource when i try to conceive Music Player with flutter

I'm trying to make music player with flutter; but I get Invalid resource error when I try to play.
That's part of code where I get Music localy on my computer.
import 'package:flutter/material.dart';
import 'music.dart';
import 'package:audioplayer2/audioplayer2.dart';
import 'package:volume/volume.dart';
import 'package:flutter/services.dart';
import 'dart:async';
...
List<Musique> musiques = [
new Musique("Je benirai", "Anna TEKO", "assets/anaTeko.jpg", "assets/anna_teko.mp3"),
new Musique("Victory", "Eben Victory", "assets/ebenVictory.jpg", "assets/EbenVictory1.mp3"),
new Musique("Tramadole", "Tony X", "assets/trama1.jpg", "assets/tramadole.mp3")
];
And my log
E/MediaPlayerNative(30743): stop called in state 1, mPlayer(0x0)
E/MediaPlayerNative(30743): error (-38, 0)
V/MediaPlayer(30743): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(30743): cleanDrmObj: mDrmObj=null mDrmSessionId=null
W/MediaPlayer(30743): mediaplayer went away with unhandled events
W/bz.rxla.flutter/audio(30743): Invalid DataSource
W/bz.rxla.flutter/audio(30743): java.io.IOException: setDataSource failed.
W/bz.rxla.flutter/audio(30743): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1191)
W/bz.rxla.flutter/audio(30743): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1164)
W/bz.rxla.flutter/audio(30743): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1131)
W/bz.rxla.flutter/audio(30743): at bz.rxla.audioplayer.AudioplayerPlugin.play(AudioplayerPlugin.java:117)
W/bz.rxla.flutter/audio(30743): at bz.rxla.audioplayer.AudioplayerPlugin.onMethodCall(AudioplayerPlugin.java:49)
W/bz.rxla.flutter/audio(30743): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:230)
W/bz.rxla.flutter/audio(30743): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
W/bz.rxla.flutter/audio(30743): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692)
W/bz.rxla.flutter/audio(30743): at android.os.MessageQueue.nativePollOnce(Native Method)
W/bz.rxla.flutter/audio(30743): at android.os.MessageQueue.next(MessageQueue.java:326)
W/bz.rxla.flutter/audio(30743): at android.os.Looper.loop(Looper.java:160)
W/bz.rxla.flutter/audio(30743): at android.app.ActivityThread.main(ActivityThread.java:6669)
W/bz.rxla.flutter/audio(30743): at java.lang.reflect.Method.invoke(Native Method)
W/bz.rxla.flutter/audio(30743): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/bz.rxla.flutter/audio(30743): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/flutter (30743): Invalid Datasource
But on first time I have not use the assets path to access music like
List<Musique> musiques = [
new Musique("Je benirai", "Anna TEKO", "assets/anaTeko.jpg", "/home/mediasoft/AndroidStudioProjects/musicApp/musics/anna_teko.mp3"),
new Musique("Victory", "Eben Victory", "assets/ebenVictory.jpg", "/home/mediasoft/AndroidStudioProjects/musicApp/musics/EbenVictory1.mp3"),
new Musique("Tramadole", "Tony X", "assets/trama1.jpg", "/home/mediasoft/AndroidStudioProjects/musicApp/musics/tramadole.mp3")
];
Need help. thanks