Canardoux / flutter_sound

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

[BUG]: error when using "openAudioSession", every second time #648

Closed RaphiTobi closed 3 years ago

RaphiTobi commented 3 years ago

Flutter Sound Version : 8.0.0+6

Severity

Minor issue, error every second time "openAudioSession" is called (Only if App is used with Hot Relstart)

Platforms you faced the error


Describe the bug If i test my app which uses the Recorder and need to use Hot Restart, then the Recorder wont work, if i Hot Restart again the Recorder will work again

To Reproduce Steps to reproduce the behavior:

  1. in init start audio session (openAudioSession)
  2. Use Hot Restart (3. closeAudioSession is in dispose, but probably doesnt matter for Hot Reload)
  3. See error

Logs!!!!

(This is very important. Most of the time we cannot do anything if we do not have information on your bug)

error


Additional Remarks

I already checked your code for possible errors, that i could have caused, and I think I might have found where the issue resides. in "tau/flutter_sound/android/src/main/java/com/dooboolab/fluttersound/FlutterSoundManager.java lines: 102-113 if in the file line 108 (the reset method) gets executed it uses "result.success ( "reset" ); " (FlutterSoundRecorder.java line: 148) -> which is a string and thus cannot be converted to int (as indecated by my error log)


marcoberetta96 commented 3 years ago

I suggest to double check that you are triggering playerModule.closeAudioSession() also when you hot restart. This solved for me.

yun-cheng commented 3 years ago

I suggest to double check that you are triggering playerModule.closeAudioSession() also when you hot restart. This solved for me.

I have the same problem using Simple Recorder in the example app after hot restart. How did you solve the problem?

RaphiTobi commented 3 years ago

Are you running the newest version of the libary? The error describe in this Bug Issue was fixed in version 8.1.4. I just tested the code I hade the problem with and it worked fine with the newest version of the library (8.1.9). You either need to use a newer version or maybe you have a different bug causing the same symtoms.

Larpoux commented 3 years ago

Thank you @TobiGamer for having shared your experience.

Please re-open this issue if you encounter other problems