Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
875 stars 569 forks source link

[BUG] Crash when startPlayer on Android device help me please #351

Closed BeshoyMelika closed 4 years ago

BeshoyMelika commented 4 years ago

Flutter Sound Lite Version : 4.0.1+1


Severity

Platforms you faced the error


Logs

V/MediaHTTPService(22245): MediaHTTPService(android.media.MediaHTTPService@b2b93fd): Cookies: null V/MediaHTTPService(22245): makeHTTPConnection: CookieManager created: java.net.CookieManager@fdbfb43 V/MediaHTTPService(22245): makeHTTPConnection(android.media.MediaHTTPService@b2b93fd): cookieHandler: java.net.CookieManager@fdbfb43 Cookies: null I/DpmTcmClient(22245): RegisterTcmMonitor from: com.android.okhttp.TcmIdleTimerMonitor D/NetworkSecurityConfig(22245): No Network Security Config specified, using platform default D/FlutterSoundPlugin(22245): mediaPlayer prepared and start D/AndroidRuntime(22245): Shutting down VM E/AndroidRuntime(22245): FATAL EXCEPTION: main E/AndroidRuntime(22245): Process: com.mmd.fms, PID: 22245 E/AndroidRuntime(22245): java.lang.IllegalArgumentException: Non-positive period. E/AndroidRuntime(22245): at java.util.Timer.schedule(Timer.java:254) E/AndroidRuntime(22245): at com.dooboolab.fluttersound.FlutterSoundPlayer.onPrepared(FlutterSoundPlayer.java:486) E/AndroidRuntime(22245): at com.dooboolab.fluttersound.FlutterSoundPlayer.lambda$_startPlayer$0$FlutterSoundPlayer(FlutterSoundPlayer.java:407) E/AndroidRuntime(22245): at com.dooboolab.fluttersound.-$$Lambda$FlutterSoundPlayer$kiGlS4RUaNAFd-Zz2ycC7CRNRNs.onPrepared(Unknown Source:6) E/AndroidRuntime(22245): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3431) E/AndroidRuntime(22245): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(22245): at android.os.Looper.loop(Looper.java:201) E/AndroidRuntime(22245): at android.app.ActivityThread.main(ActivityThread.java:6810) E/AndroidRuntime(22245): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(22245): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) E/AndroidRuntime(22245): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873) I/Process (22245): Sending signal. PID: 22245 SIG: 9 Lost connection to device.

flutter doctor :

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.15.4 19E287, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc1) [✓] Xcode - develop for iOS and macOS (Xcode 11.3) [✓] Android Studio (version 3.6) [✓] IntelliJ IDEA Community Edition (version 2018.3.2) [✓] VS Code (version 1.45.0) [✓] Connected device (2 available)

• No issues found!

flutter pub deps :

Dart SDK 2.8.1 Flutter SDK 1.17.0 fms 1.0.0+1 |-- cached_network_image 2.2.0+1 | |-- flutter... | '-- flutter_cache_manager 1.2.2 | |-- clock 1.0.1 | | '-- meta... | |-- file 5.1.0 | | |-- intl... | | |-- meta... | | '-- path... | |-- flutter... | |-- http... | |-- path... | |-- path_provider... | |-- pedantic... | |-- rxdart 0.24.0 | |-- sqflite 1.3.0+1 | | |-- flutter... | | |-- path... | | '-- sqflite_common 1.0.1 | | |-- meta... | | |-- path... | | '-- synchronized 2.2.0 | '-- uuid 2.0.4 | |-- convert... | '-- crypto... |-- cupertino_icons 0.1.3 |-- equatable 1.1.1 | |-- collection... | '-- meta... |-- firebase_messaging 6.0.13 | |-- flutter... | |-- meta... | '-- platform 2.2.1 |-- flutter 0.0.0 | |-- collection 1.14.12 | |-- meta 1.1.8 | |-- sky_engine 0.0.99 | |-- typed_data 1.1.6 | '-- vector_math 2.0.8 |-- flutter_bloc 4.0.0 | |-- bloc 4.0.0 | | '-- meta... | |-- flutter... | '-- provider 4.1.1 | |-- collection... | |-- flutter... | '-- nested 0.0.4 | '-- flutter... |-- flutter_cupertino_localizations 1.0.1 | |-- flutter... | '-- flutter_localizations... |-- flutter_localizations 0.0.0 | |-- collection... | |-- flutter... | |-- intl 0.16.1 | | '-- path... | |-- meta... | |-- path 1.6.4 | |-- typed_data... | '-- vector_math... |-- flutter_sound_lite 4.0.4+1 | |-- flutter... | |-- path... | |-- path_provider 1.6.7 | | |-- flutter... | | |-- path_provider_macos 0.0.4+2 | | | '-- flutter... | | '-- path_provider_platform_interface 1.0.1 | | |-- flutter... | | |-- meta... | | |-- platform... | | '-- plugin_platform_interface... | '-- permission_handler 5.0.0+hotfix.5 | |-- flutter... | |-- meta... | '-- permission_handler_platform_interface 2.0.0 | |-- flutter... | |-- meta... | '-- plugin_platform_interface... |-- flutter_test 0.0.0 | |-- archive 2.0.13 | | |-- args... | | |-- crypto... | | '-- path... | |-- args 1.6.0 | |-- async 2.4.1 | | '-- collection... | |-- boolean_selector 2.0.0 | | |-- source_span... | | '-- string_scanner... | |-- charcode 1.1.3 | |-- collection... | |-- convert 2.1.1 | | |-- charcode... | | '-- typed_data... | |-- crypto 2.1.4 | | |-- collection... | | |-- convert... | | '-- typed_data... | |-- flutter... | |-- image 2.1.12 | | |-- archive... | | '-- xml... | |-- matcher 0.12.6 | | '-- stack_trace... | |-- meta... | |-- path... | |-- petitparser 2.4.0 | | '-- meta... | |-- quiver 2.1.3 | | |-- matcher... | | '-- meta... | |-- source_span 1.7.0 | | |-- charcode... | | |-- collection... | | |-- meta... | | |-- path... | | '-- term_glyph... | |-- stack_trace 1.9.3 | | '-- path... | |-- stream_channel 2.0.0 | | '-- async... | |-- string_scanner 1.0.5 | | |-- charcode... | | |-- meta... | | '-- source_span... | |-- term_glyph 1.1.0 | |-- test_api 0.2.15 | | |-- async... | | |-- boolean_selector... | | |-- collection... | | |-- matcher... | | |-- meta... | | |-- path... | | |-- source_span... | | |-- stack_trace... | | |-- stream_channel... | | |-- string_scanner... | | '-- term_glyph... | |-- typed_data... | |-- vector_math... | '-- xml 3.6.1 | |-- collection... | |-- convert... | |-- meta... | '-- petitparser... |-- fluttertoast 3.1.3 | '-- flutter... |-- http 0.12.1 | |-- http_parser 3.1.4 | | |-- charcode... | | |-- collection... | | |-- source_span... | | |-- string_scanner... | | '-- typed_data... | |-- path... | '-- pedantic 1.9.0 |-- image_picker 0.6.6+1 | |-- flutter... | |-- flutter_plugin_android_lifecycle 1.0.7 | | '-- flutter... | '-- image_picker_platform_interface 1.0.0 | |-- flutter... | |-- meta... | '-- plugin_platform_interface 1.0.2 | '-- meta... |-- multi_image_picker 4.6.7 | |-- flutter... | '-- meta... |-- photo_view 0.9.2 | '-- flutter... |-- progress_dialog 1.2.2 | '-- flutter... |-- shared_preferences 0.5.7+1 | |-- flutter... | |-- meta... | |-- shared_preferences_macos 0.0.1+8 | | |-- flutter... | | '-- shared_preferences_platform_interface... | |-- shared_preferences_platform_interface 1.0.3 | | |-- flutter... | | '-- meta... | '-- shared_preferences_web 0.1.2+5 | |-- flutter... | |-- flutter_web_plugins 0.0.0 | | |-- collection... | | |-- flutter... | | |-- meta... | | |-- typed_data... | | '-- vector_math... | |-- meta... | '-- shared_preferences_platform_interface... '-- validators 2.0.0+1


Describe the bug

when play sound from URL or File app crash in only android device String path; String audioFilePath; if (media == AudioMEDIA.RECORDING) { if (await fileExists(_path)) audioFilePath = this._path; } else if (media == AudioMEDIA.HEARING) { audioFilePath = widget.url; } if (audioFilePath != null) { path = await playerModule.startPlayer(audioFilePath, codec: _codec, whenFinished: () { setState(() {}); }); }

Expected behavior A clear and concise description of what you expected to happen.


Larpoux commented 4 years ago

Are you sure to use

myPlayer.setSubscriptionDuration(numberSec);

with (numberSec > 0) ?

BeshoyMelika commented 4 years ago

@Larpoux Thank you so much this was the problem

Larpoux commented 4 years ago

You are welcome 😸