florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
757 stars 368 forks source link

exoplayer2.ParserException wav local file #341

Closed dfdgsdfg closed 4 years ago

dfdgsdfg commented 4 years ago

Flutter Version

My version : 1.20.2

Lib Version

My version : 2.0.9 + 2

Platform (Android / iOS / web) + version

Platform: Android API 29

Describe the bug

Seems ExoPlayer fail then fallback to mediaplayer.

The first play is okay but after that, it does not play anymore without any error or any reaction.

I/flutter (31092): CreateShortPostBloc: stopRecord: /data/user/0/my.app.dev/app_flutter/tmp.wav
I/ExoPlayerImpl(31092): Init 512a8e9 [ExoPlayerLib/2.11.4] [laurel_sprout, Mi A3, Xiaomi, 29]
E/ExoPlayerImplInternal(31092): Source error
E/ExoPlayerImplInternal(31092):   com.google.android.exoplayer2.ParserException: Expected block size: 2; got: 1
E/ExoPlayerImplInternal(31092):       at com.google.android.exoplayer2.extractor.wav.WavExtractor$PassthroughOutputWriter.<init>(WavExtractor.java:222)
E/ExoPlayerImplInternal(31092):       at com.google.android.exoplayer2.extractor.wav.WavExtractor.read(WavExtractor.java:122)
E/ExoPlayerImplInternal(31092):       at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:982)
E/ExoPlayerImplInternal(31092):       at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:391)
E/ExoPlayerImplInternal(31092):       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/ExoPlayerImplInternal(31092):       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/ExoPlayerImplInternal(31092):       at java.lang.Thread.run(Thread.java:919)
I/ExoPlayerImpl(31092): Release 512a8e9 [ExoPlayerLib/2.11.4] [laurel_sprout, Mi A3, Xiaomi, 29] [goog.exo.core]
V/MediaPlayer(31092): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(31092): cleanDrmObj: mDrmObj=null mDrmSessionId=null
I/flutter (31092): asdfasdfasdfasdf true
I/flutter (31092): CreateShortPostBloc: playRecorded
V/MediaPlayer(31092): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(31092): cleanDrmObj: mDrmObj=null mDrmSessionId=null
W/MediaPlayer(31092): mediaplayer went away with unhandled events

Small code to reproduce

dfdgsdfg commented 4 years ago

https://github.com/ryanheise/just_audio/issues/158

Seems exoplayer2 parser error.

The Wave file generated by https://pub.dev/packages/flutter_audio_recorder.

dfdgsdfg commented 4 years ago

It is just the wrong wave header problem.

https://github.com/rmbrone/flutter_audio_recorder/issues/11

Asset_player is working just fine.