didChangeAppLifecycleState method

  1. @override
void didChangeAppLifecycleState(
  1. AppLifecycleState state
)
override

Handle audio lifecycle changes.

Implementation

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
  if (state == AppLifecycleState.paused) {
    _appPaused = true;
    if (_playing && !_playInBackground) {
      _pauseNative();
    }
  } else if (state == AppLifecycleState.resumed) {
    _appPaused = false;
    if (_playing && !_playInBackground) {
      _playNative(false, _endpointSeconds);
    }
  }
}