chewie icon indicating copy to clipboard operation
chewie copied to clipboard

Question: Update Overlay when video position != 0

Open gbminnock opened this issue 3 years ago • 4 comments

Hi,

thank you for your work on chewie.

I have separate image posters/thumbnails for my videos and would like to show them only when the video position is at zero.

I've setup an overlay widget and a listener on the videoplayer controller; when the videoplayer.value.position !=0 then I want to remove the overlay; however the overlay is final so I don't think I can update.

Is there an alternative approach to this? I could show the poster/thumbnail in a Stack Widget but I think updating the overlay would be a better option.

Thanks!

gbminnock avatar Feb 18 '22 12:02 gbminnock

@gbminnock have you tried returning Container when the position doesn't equal zero?

diegotori avatar Feb 18 '22 12:02 diegotori

In other words, if the builder gets called every time the position changes, then you should be able to send back an empty Container when it's greater than zero.

diegotori avatar Feb 18 '22 13:02 diegotori

In other words, if the builder gets called every time the position changes, then you should be able to send back an empty Container when it's greater than zero.

@diegotori You mean to set the _chewieController.overlay = Container() ? I'm not sure I follow...

gbminnock avatar Feb 18 '22 16:02 gbminnock

Sorry, I misspoke. ChewieController has a copyWith method that should allow you to update the Overlay Widget when that event occurs, then merely call setState() to rebuild the Widget.

diegotori avatar Feb 18 '22 16:02 diegotori