Tau: [bug] Hot Restart

Created on 16 Dec 2020  Â·  9Comments  Â·  Source: Canardoux/tau

The app uses FlutterSoundPlayer singleton to play audio. When it is hot restart app, the program will crash.

when call await playerModule.openAudioSession() in iOS, program will crash。 but It's good on Android

FlutterSoundPlayer playerModule = FlutterSoundPlayer();
  bool _isMute = false;
  bool _isPlayInited = false;

  static SoundManager _getInstance() {
    if (_instance == null) {
      _instance = new SoundManager._internal();
    }
    return _instance;
  }

  SoundManager._internal() {
    initAudioPlay();
  }

  Future<void> initAudioPlay() async {
    try {
      await playerModule.openAudioSession(
          focus: AudioFocus.requestFocusAndStopOthers,
          category: SessionCategory.playAndRecord);
      await playerModule.setSubscriptionDuration(Duration(milliseconds: 100));
      _isPlayInited = true;
      return Future.value(true);
    } catch(e){
      return Future.value(false);
    }
  }
bug Done

All 9 comments

Can we have your logs ?

Can we have your logs ?

flutter: FS:---> openAudioSession
Lost connection to device.

not too mush log
maybe iOS can not reset audio session

Get too this error when working on my phone and making some hot restart.

Several Flutter Sound users complained about that.

There is really something wrong in Flutter Sound. @bsutton investigated this and found the solution but he does not want to work anymore with us 👎 .

Registered in the Flutter Sound Project

The problem should be here

`
FlutterSoundPlayerCallback getSession(int slotno)
{
return _slots[slotno];
}

`

image

image

Yes, someone told me that the slot manager does not work well with hot restart.
This must be investigated ... and fixed.

This bug should be solved first. Every hot restart causes the crash to disconnect, and it takes at least 3 minutes to restart the app. Greatly affect development efficiency.

In Hot Restart on iOS, it will still cause the app to crash and disconnect the debug connection.
I now have to develop on Android first to avoid encountering this problem frequently.

Hope someone can solve this problem.

Fixed in Flutter Sound release 7.6.3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hanj315 picture hanj315  Â·  5Comments

satyajitghana picture satyajitghana  Â·  3Comments

jordygarcias picture jordygarcias  Â·  5Comments

palfrey picture palfrey  Â·  3Comments

mhstoller picture mhstoller  Â·  5Comments