onPlayerVisibilityChanged method
void
onPlayerVisibilityChanged(
- double visibilityFraction
)
Implementation
void onPlayerVisibilityChanged(double visibilityFraction) async {
if (_dispose) {
return;
}
value = value.copyWith(visibilityFraction: visibilityFraction);
if (value.videoPlayerController == null) {
return;
}
if (value.videoPlayerController != null) {
if (visibilityFraction == 0) {
_wasPlayingBeforePause = value.videoPlayerController!.value.isPlaying;
if (_wasPlayingBeforePause) {
await pause();
}
} else {
if (_wasPlayingBeforePause && value.configuration.autoPlayWhenResume) {
_wasPlayingBeforePause = false;
await play();
}
_onVideoPlayerChanged();
}
}
}