Open zhushenwudi opened 2 years ago
This is not a bug, it is only an issue by business, if repository owner read my issue, consider whether to add to these code.
I add these code in "assets_audio_player.dart" about 310 lines.
final BehaviorSubject<bool> _isFirstBackgroundToForeground = BehaviorSubject<bool>.seeded(false);
bool get isFirstBackgroundToForeground {
final isFirst = _isFirstBackgroundToForeground.stream.value;
_isFirstBackgroundToForeground.value = false;
return isFirst;
}
And then I add these code at AppLifecycleObserver callback in "assets_audio_player.dart".
onChanged: (isActive) {
_isFirstBackgroundToForeground.value = isActive;
}
At last, can use at main code, it can not broken player logic because you can not set value.
mPlayer.isFirstBackgroundToForeground
Flutter Version
My version : 2.10.4
Lib Version
My version : 3.0.4+1
Platform (Android / iOS / web) + version
Platform : android
Describe the bug
Switch to the background when a song is playing, switch to the next song, return to the foreground, and the song will be played again