I am working with a video player called ‘flick video player’. I can play videos fairly okay with default functionality. The problem occurs when I scroll down the screen and the video continues to play in the background. I would like to pause it when it isn’t visible, or when a user navigates to a different page on the project app.
The video player that I am using (flick_video_player) has video_player as its dependency.
Answers are much appreciated.
Regards
4
Answers
Wrap your list of videos with a
NotificationListener
and listen to whether the user has started or stopped scrolling. Use this value to either play or pause your video.Edit: misread your question. This will work for pausing once the user scrolls. If you want to detect whether the video is within the current view, check out ScrollablePositionedList.
Maybe this visibility detector package can help https://pub.dev/packages/visibility_detector
This is exactly what you need, inview_notifier_list:
I think you can use visibility detector for the purpose-
I was working on something similar. For more info like how to play it again and more you can refer this repo- https://github.com/GeekyAnts/flick-video-player/tree/master/example/lib/feed_player
Hope it helped!