[BUG] Android audio playback Non-positive period
See original GitHub issueFlutter Sound Version :
5.1.1
-
Released or Beta version ? Released
-
Version number ? flutter 1.17.5
-
FULL or LITE flavor ? FULL and LITE
-
Result of the command “flutter pub deps | grep flutter_sound” (very important)
FlutterSoundPlayer _flutterSoundPlayer = FlutterSoundPlayer();
await _flutterSoundPlayer.openAudioSession();
await _flutterSoundPlayer.startPlayer(
fromURI: (await recording.audioFile).path);
_progressSubscription =
_flutterSoundPlayer.onProgress.listen(_audioPlayerListener);
Severity
- Crash
Platforms you faced the error
- Android
- Real device Samsung S8
Logs
(This is very important. Most of the time we cannot do anything if we do not have information on your bug)
I/flutter (25448): FS:---> openAudioSession
D/AudioManager(25448): setBluetoothScoOn false
D/AudioManager(25448): setSpeakerphoneOn true
D/AudioManager(25448): setSpeakerphoneOn true
D/AudioManager(25448): setBluetoothScoOn true
I/flutter (25448): FS:<--- openAudioSession
I/flutter (25448): play
I/flutter (25448): FS:---> startPlayer
I/flutter (25448): FS:---> stop
I/flutter (25448): FS:<--- stop
I/flutter (25448): FS:---> _convert
I/flutter (25448): FS:---> needToConvert
I/flutter (25448): FS:<--- needToConvert
I/flutter (25448): FS:<--- _convert
I/MediaPlayer(25448): Need to enable context aware info
V/MediaPlayer-JNI(25448): native_setup
V/MediaPlayerNative(25448): constructor
V/MediaPlayerNative(25448): setListener
V/MediaPlayer-JNI(25448): setDataSourceFD: fd 93
V/MediaPlayerNative(25448): setDataSource(93, 0, 576460752303423487)
V/MediaPlayerNative(25448): setVideoSurfaceTexture
V/MediaPlayerNative(25448): prepare
V/MediaPlayerNative(25448): message received msg=200, ext1=10973, ext2=0
W/MediaPlayerNative(25448): info/warning (10973, 0)
V/MediaPlayerNative(25448): callback application
V/MediaPlayerNative(25448): back from callback
V/MediaPlayerNative(25448): message received msg=1, ext1=0, ext2=0
V/MediaPlayerNative(25448): MediaPlayer::notify() prepared
V/MediaPlayerNative(25448): signal application thread
V/MediaPlayerNative(25448): callback application
V/MediaPlayerNative(25448): prepare complete - status=0
V/MediaPlayerNative(25448): back from callback
V/MediaPlayerNative(25448): invoke 68
V/MediaPlayer-JNI(25448): getCurrentPosition: 0 (msec)
V/MediaPlayerNative(25448): invoke 68
I/flutter (25448): FS:<--- startPlayer
D/FlutterSoundPlugin(25448): mediaPlayer prepared and start
V/MediaPlayer-JNI(25448): start
V/MediaPlayerNative(25448): start
I/flutter (25448): dismissOverlay
V/MediaPlayerNative(25448): message received msg=300, ext1=0, ext2=0
V/MediaPlayerNative(25448): Received SEC_MM_PLAYER_CONTEXT_AWARE
V/MediaPlayerNative(25448): callback application
V/MediaPlayerNative(25448): back from callback
D/AndroidRuntime(25448): Shutting down VM
E/AndroidRuntime(25448): FATAL EXCEPTION: main
E/AndroidRuntime(25448): java.lang.IllegalArgumentException: Non-positive period.
E/AndroidRuntime(25448): at java.util.Timer.schedule(Timer.java:254)
E/AndroidRuntime(25448): at com.dooboolab.fluttersound.FlutterSoundPlayer.onPrepared(FlutterSoundPlayer.java:462)
E/AndroidRuntime(25448): at com.dooboolab.fluttersound.FlutterSoundPlayer.lambda$startPlayer$0$FlutterSoundPlayer(FlutterSoundPlayer.java:375)
E/AndroidRuntime(25448): at com.dooboolab.fluttersound.-$$Lambda$FlutterSoundPlayer$CKEELXPVh5rkG3TIOBhd8o5Vky8.onPrepared(Unknown Source:4)
E/AndroidRuntime(25448): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:4238)
E/AndroidRuntime(25448): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(25448): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(25448): at android.app.ActivityThread.main(ActivityThread.java:7050)
E/AndroidRuntime(25448): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(25448): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/AndroidRuntime(25448): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
I/Process (25448): Sending signal. PID: 25448 SIG: 9
Lost connection to device.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
[BUG] Android audio playback Non-positive period · Issue #417
Flutter Sound Version : 5.1.1 Released or Beta version ? ... [BUG] Android audio playback Non-positive period #417.
Read more >How to Fix Audio and Video out of Sync Problem on Android?
Step 1: Select the Output Format · Step 2: Check for the Audio and Video Sync Value · Step 3: Pause the Playback...
Read more >The Android Audio Path Latency Explainer - Superpowered
Period size = 480 samples. · Period count = 2. · The ring buffer's size is 480x2 = 960 samples. · Audio input...
Read more >AudioManager - Android Developers
AudioAttributes) : direct offload playback supported with gapless transitions. ... A negative value indicates the audio signal is attenuated.
Read more >Audio "Playback Time" - Android Forums at AndroidCentral.com
Does anyone know why the phone can't go into a deep sleep? Being awake for so long has is having a negative impact...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It works well on android!
It seems that FS has a concurrency bug, here. I will try to figure what, before the 6.0 release, in a few weeks. Please stay tuned.
Note: adding
await
was a rich idea. Asynchronous processing in Flutter is a real bug net. Better to stay far from this horrible dart feature. Please keep this issue open