Closed chiekkored closed 4 years ago
To those who are also struggling with the logics, I finally found a solution. I used MobX and Provider packages. Whenever I press a button from somewhere to navigate (navbar or page route), I pass a false value to isInView bool in InViewNotifierWidget builder and wrap it with MobX Observer to notify the value I passed and rebuild it.
InViewNotifierWidget(
id: '$index',
builder: (BuildContext context, bool isInView, Widget child) {
return Observer(
builder: (_) {
return VideoFeed(
play: (Provider.of<HomeModel>(context).isHomeVisible)
? isInView
: false,
url: _feedItem['video_url'],
);
},
);
},
)
Button somewhere:
onPressed: () {
Provider.of<HomeModel>(context).setisHomeVisible(false);
}
How do you keep track of the play action again(Where set isHomeVisible to true again)? If you navigate to home, it should be easy, but can be tricky on a navigator.pop
How do you keep track of the play action again(Where set isHomeVisible to true again)? If you navigate to home, it should be easy, but can be tricky on a navigator.pop
Hi @Babwenbiber, I used Provider as my State Management to listen on variable changes. I store isHomeVisible inside the HomeModel class.
How do you keep track of the play action again(Where set isHomeVisible to true again)? If you navigate to home, it should be easy, but can be tricky on a navigator.pop
Hi @Babwenbiber, I used Provider as my State Management to listen on variable changes. I store isHomeVisible inside the HomeModel class.
Yes, I've done this as well after some trial and error :D Thanks
I've implemented the auto-play and pause video list when in-view along with this plugin. I'm using AutomaticKeepAliveClientMixin to save my state when I'm changing tabs. Now, I am puzzled on how to pause the current playing video when a navigator is pushed or switching to another tabview. I've tried using VisibilityDetector but it only works on the first video widget. I also used RouteObserver to listen whenever a route is pushed and popped but it doesn't work on this plugin, the video still plays. Is there a way on how to make this possible? TIA!