setAppLifecycleState method
Set current lifecycle state. If state is AppLifecycleState.resumed then player starts playing again. if lifecycle is in AppLifecycleState.paused state, then video playback will stop. If showNotification is set in data source or handleLifecycle is false then this logic will be ignored.
Implementation
void setAppLifecycleState(AppLifecycleState appLifecycleState) {
if (_isAutomaticPlayPauseHandled()) {
_appLifecycleState = appLifecycleState;
if (appLifecycleState == AppLifecycleState.resumed) {
if (_wasPlayingBeforePause == true && _isPlayerVisible) {
play();
}
}
if (appLifecycleState == AppLifecycleState.paused) {
_wasPlayingBeforePause ??= isPlaying();
pause();
}
}
}