rxlabz / audioplayer

A flutter plugin to play audio files iOS / Android / MacOS / Web ( Swift/Java )
https://pub.dartlang.org/packages/audioplayer
494 stars 189 forks source link

Not playing on LG 440 #9

Open johanhenselmans opened 6 years ago

johanhenselmans commented 6 years ago

I am having troubles playing with the audio player on a LG440H: (Android 6.01, 16 GB SDCard)

this is the error I am getting. The same app works OK on a Nexus 7.

I/flutter (12152): soundfile path = /data/user/0/com.yourcompany.muze/app_flutter/sound/Schippers-hetoverhevelenvangewicht-toelichting.mp3 E/ExtMediaPlayer-JNI(12152): QCMediaPlayer could not be located.... D/MediaPlayer-JNI(12152): JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 E/ExtMediaPlayer-JNI(12152): QCMediaPlayer could not be located.... D/MediaPlayer-JNI(12152): JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 V/MediaPlayerNative: constructor D/AudioSystem(12152): getIoDescriptor: ioHandle = 2, index = -2, mIoDescriptors = 0xb9cddd28 V/AudioSystem(12152): ioConfigChanged: [Update mIoDescriptors] add ioHandle = 2 -> descriptor = 0xa0be977c V/AudioSystem(12152): ioConfigChanged() new output opened 2 samplingRate 48000, format 0x1 channel mask 0x3 frameCount 960 deviceId 2 D/AudioSystem(12152): getIoDescriptor: ioHandle = 4, index = -2, mIoDescriptors = 0xb9cddd28 V/AudioSystem(12152): ioConfigChanged: [Update mIoDescriptors] add ioHandle = 4 -> descriptor = 0xa0be977c V/AudioSystem(12152): ioConfigChanged() new output opened 4 samplingRate 48000, format 0x5 channel mask 0x3 frameCount 960 deviceId 2 V/MediaPlayerNative: setListener V/MediaPlayerNative: MediaPlayer::setAudioStreamType V/MediaPlayerNative: setDataSource(61, 0, 576460752303423487) E/MediaPlayerNative: Unable to create media player W/System.err(12152): java.io.IOException: setDataSourceFD failed.: status=0x80000000 W/System.err(12152): at android.media.MediaPlayer._setDataSource(Native Method) W/System.err(12152): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1133) W/System.err(12152): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1118) W/System.err(12152): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1097) W/System.err(12152): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1046) W/System.err(12152): at bz.rxla.audioplayer.AudioplayerPlugin.play(AudioplayerPlugin.java:85) W/System.err(12152): at bz.rxla.audioplayer.AudioplayerPlugin.onMethodCall(AudioplayerPlugin.java:44) W/System.err(12152): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191) W/System.err(12152): at io.flutter.view.FlutterView.handlePlatformMessage(FlutterView.java:690) W/System.err(12152): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err(12152): at android.os.MessageQueue.next(MessageQueue.java:323) W/System.err(12152): at android.os.Looper.loop(Looper.java:135) W/System.err(12152): at android.app.ActivityThread.main(ActivityThread.java:5527) W/System.err(12152): at java.lang.reflect.Method.invoke(Native Method) W/System.err(12152): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) W/System.err(12152): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) D/AUDIO (12152): invalid DataSource V/MediaPlayerNative: setVideoSurfaceTexture V/MediaPlayerNative: setVideoSurfaceTexture: 0x0 mPlayer: NO_INIT V/MediaPlayerNative: prepare E/MediaPlayerNative: prepareAsync called in state 1 E/MethodChannel#bz.rxla.flutter/audio(12152): Failed to handle method call E/MethodChannel#bz.rxla.flutter/audio(12152): java.lang.IllegalStateException E/MethodChannel#bz.rxla.flutter/audio(12152): at android.media.MediaPlayer._prepare(Native Method) E/MethodChannel#bz.rxla.flutter/audio(12152): at android.media.MediaPlayer.prepare(MediaPlayer.java:1163) E/MethodChannel#bz.rxla.flutter/audio(12152): at bz.rxla.audioplayer.AudioplayerPlugin.play(AudioplayerPlugin.java:92) E/MethodChannel#bz.rxla.flutter/audio(12152): at bz.rxla.audioplayer.AudioplayerPlugin.onMethodCall(AudioplayerPlugin.java:44) E/MethodChannel#bz.rxla.flutter/audio(12152): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191) E/MethodChannel#bz.rxla.flutter/audio(12152): at io.flutter.view.FlutterView.handlePlatformMessage(FlutterView.java:690) E/MethodChannel#bz.rxla.flutter/audio(12152): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#bz.rxla.flutter/audio(12152): at android.os.MessageQueue.next(MessageQueue.java:323) E/MethodChannel#bz.rxla.flutter/audio(12152): at android.os.Looper.loop(Looper.java:135) E/MethodChannel#bz.rxla.flutter/audio(12152): at android.app.ActivityThread.main(ActivityThread.java:5527) E/MethodChannel#bz.rxla.flutter/audio(12152): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#bz.rxla.flutter/audio(12152): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) E/MethodChannel#bz.rxla.flutter/audio(12152): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) E/flutter (12152): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception: E/flutter (12152): PlatformException(error, null, null) E/flutter (12152): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:514) E/flutter (12152): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:154) E/flutter (12152): E/flutter (12152): #2 AudioPlayer.play (package:audioplayer/audioplayer.dart:27) E/flutter (12152): #3 _MuzeAudioPlayerState._playLocal (file:///Users/johan/projecten/muze/Code/flutter/muze/lib/muzeutils.dart:358) E/flutter (12152): E/flutter (12152): #4 _MuzeAudioPlayerState.build. (file:///Users/johan/projecten/muze/Code/flutter/muze/lib/muzeutils.dart:436) E/flutter (12152): #5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:323) E/flutter (12152): #6 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:375) E/flutter (12152): #7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102) E/flutter (12152): #8 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:149) E/flutter (12152): #9 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:92) E/flutter (12152): #10 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315) E/flutter (12152): #11 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73) E/flutter (12152): #12 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101) E/flutter (12152): #13 BindingBase&SchedulerBinding&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143) E/flutter (12152): #14 BindingBase&SchedulerBinding&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121) E/flutter (12152): #15 BindingBase&SchedulerBinding&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101) E/flutter (12152): #16 BindingBase&SchedulerBinding&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64) E/flutter (12152): #17 BindingBase&SchedulerBinding&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48) E/flutter (12152): #18 _invoke1 (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:105) E/flutter (12152): #19 _dispatchPointerDataPacket (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:63)

After I try to load another sound ( by going to another page and reloading the sound), this is the message I am getting:

E/MediaPlayerNative: Attempt to call getDuration without a valid mediaplayer V/MediaPlayerNative: message received msg=100, ext1=-38, ext2=0 E/MediaPlayerNative: error (-38, 0) V/MediaPlayerNative: signal application thread V/MediaPlayerNative: start E/MediaPlayerNative: start called in state 0 V/MediaPlayerNative: message received msg=100, ext1=-38, ext2=0 V/MediaPlayerNative: notify(100, -38, 0) callback on disconnected mediaplayer I/flutter (12152): _platformCallHandler call audio.onDuration 1893238280 V/MediaPlayerNative: message received msg=100, ext1=-38, ext2=0 V/MediaPlayerNative: notify(100, -38, 0) callback on disconnected mediaplayer V/MediaPlayerNative: isPlaying: no active player I/flutter (12152): nessage in HomePage is playing V/MediaPlayerNative: isPlaying: no active player V/MediaPlayerNative: message received msg=100, ext1=-38, ext2=0 V/MediaPlayerNative: notify(100, -38, 0) callback on disconnected mediaplayer I/flutter (12152): nessage is playing I/flutter (12152): nessage is playing I/flutter (12152): nessage in HomePage is playing I/flutter (12152): nessage is playing I/flutter (12152): nessage in HomePage is playing I/flutter (12152): nessage is playing I/flutter (12152): _platformCallHandler call audio.onCurrentPosition 1893238240 V/MediaPlayerNative: isPlaying: no active player V/MediaPlayerNative: message received msg=100, ext1=-38, ext2=0

rxlabz commented 6 years ago

Hi, can you please try with a lowercase file name ?

johanhenselmans commented 6 years ago

No difference..

I/flutter (15116): soundfile path = /data/user/0/com.yourcompany.muze/app_flutter/sound/toelichting-bk-ja-knibbe.mp3 E/ExtMediaPlayer-JNI(15116): QCMediaPlayer could not be located.... D/MediaPlayer-JNI(15116): JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 E/ExtMediaPlayer-JNI(15116): QCMediaPlayer could not be located.... D/MediaPlayer-JNI(15116): JNIMediaPlayerFactory: bIsQCMediaPlayerPresent 0 V/MediaPlayerNative: constructor V/MediaPlayerNative: setListener V/MediaPlayerNative: MediaPlayer::setAudioStreamType V/MediaPlayerNative: setDataSource(68, 0, 576460752303423487) D/AudioSystem(15116): getIoDescriptor: ioHandle = 2, index = -2, mIoDescriptors = 0xba78eaf8 V/AudioSystem(15116): ioConfigChanged: [Update mIoDescriptors] add ioHandle = 2 -> descriptor = 0xa0aeb77c V/AudioSystem(15116): ioConfigChanged() new output opened 2 samplingRate 48000, format 0x1 channel mask 0x3 frameCount 960 deviceId 2 E/MediaPlayerNative: Unable to create media player D/AudioSystem(15116): getIoDescriptor: ioHandle = 4, index = -2, mIoDescriptors = 0xba78eaf8 V/AudioSystem(15116): ioConfigChanged: [Update mIoDescriptors] add ioHandle = 4 -> descriptor = 0xa09ec77c V/AudioSystem(15116): ioConfigChanged() new output opened 4 samplingRate 48000, format 0x5 channel mask 0x3 frameCount 960 deviceId 2 W/System.err(15116): java.io.IOException: setDataSourceFD failed.: status=0x80000000 W/System.err(15116): at android.media.MediaPlayer._setDataSource(Native Method) W/System.err(15116): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1133) W/System.err(15116): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1118) W/System.err(15116): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1097) W/System.err(15116): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1046) W/System.err(15116): at bz.rxla.audioplayer.AudioplayerPlugin.play(AudioplayerPlugin.java:85) W/System.err(15116): at bz.rxla.audioplayer.AudioplayerPlugin.onMethodCall(AudioplayerPlugin.java:44) W/System.err(15116): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191) W/System.err(15116): at io.flutter.view.FlutterView.handlePlatformMessage(FlutterView.java:690) W/System.err(15116): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err(15116): at android.os.MessageQueue.next(MessageQueue.java:323) W/System.err(15116): at android.os.Looper.loop(Looper.java:135) W/System.err(15116): at android.app.ActivityThread.main(ActivityThread.java:5527) W/System.err(15116): at java.lang.reflect.Method.invoke(Native Method) W/System.err(15116): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) W/System.err(15116): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) D/AUDIO (15116): invalid DataSource V/MediaPlayerNative: setVideoSurfaceTexture V/MediaPlayerNative: setVideoSurfaceTexture: 0x0 mPlayer: NO_INIT V/MediaPlayerNative: prepare E/MediaPlayerNative: prepareAsync called in state 1 E/MethodChannel#bz.rxla.flutter/audio(15116): Failed to handle method call E/MethodChannel#bz.rxla.flutter/audio(15116): java.lang.IllegalStateException E/MethodChannel#bz.rxla.flutter/audio(15116): at android.media.MediaPlayer._prepare(Native Method) E/MethodChannel#bz.rxla.flutter/audio(15116): at android.media.MediaPlayer.prepare(MediaPlayer.java:1163) E/MethodChannel#bz.rxla.flutter/audio(15116): at bz.rxla.audioplayer.AudioplayerPlugin.play(AudioplayerPlugin.java:92) E/MethodChannel#bz.rxla.flutter/audio(15116): at bz.rxla.audioplayer.AudioplayerPlugin.onMethodCall(AudioplayerPlugin.java:44) E/MethodChannel#bz.rxla.flutter/audio(15116): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191) E/MethodChannel#bz.rxla.flutter/audio(15116): at io.flutter.view.FlutterView.handlePlatformMessage(FlutterView.java:690) E/MethodChannel#bz.rxla.flutter/audio(15116): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#bz.rxla.flutter/audio(15116): at android.os.MessageQueue.next(MessageQueue.java:323) E/MethodChannel#bz.rxla.flutter/audio(15116): at android.os.Looper.loop(Looper.java:135) E/MethodChannel#bz.rxla.flutter/audio(15116): at android.app.ActivityThread.main(ActivityThread.java:5527) E/MethodChannel#bz.rxla.flutter/audio(15116): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#bz.rxla.flutter/audio(15116): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) E/MethodChannel#bz.rxla.flutter/audio(15116): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) E/flutter (15116): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception: E/flutter (15116): PlatformException(error, null, null)

johanhenselmans commented 6 years ago

I found this in the meantime, it seems more people have this problem on LG phones.

I did got it to run properly on a Sony E233 (Experia M4 Aqua).

https://stackoverflow.com/questions/24501086/why-mediaplayer-throws-not-present-error-when-creating-instance-of-it

johanhenselmans commented 6 years ago

Oh, and this.

https://stackoverflow.com/questions/9888510/mediaplayer-error-19-0-after-repeated-plays,

Especially the message about the onCreate and mp.reset, so that the mediaplayer only gets created once might bear a solution.

georgealvessilveira commented 6 years ago

I am having the same issue, but my phone is a LG K130

Atlantis-lcc commented 6 years ago

any news? I have the same issue.