Krupen / AutoplayVideos

Android library to auto-play/pause videos from url in recyclerview.
Apache License 2.0
996 stars 147 forks source link

Keep playing video while is still partially on screen? #50

Closed amanzan closed 6 years ago

amanzan commented 6 years ago

Right now, as soon as any part of the video goes offscreen, the video is paused. Would it be possible to keep it playing until the video is completely offscreen? Let me know if you need further clarification.

Thanks a lot for your work, it's the only library that really helps handling videos in recyclerviews!

amanzan commented 6 years ago

I'll answer myself: inside your custom recyclerview, in playAvailableVideos, you check when the video is completely contained into the visible screen area: if (rect_parent.contains(rect_child)) {

Replacing contains by intersect, it will behave as I was trying to explain. Posting this in case it helps anybody :)

Krupen commented 6 years ago

Yes, that is the correct solution. Would be amazing if you could add it as a controllable param and create a pull request. Others may also want to control their videos like this.

Krupen commented 6 years ago

Hi, just released an update in which you can specify percentage of view that needs to be visible for videos to start playing. Check out version 0.2.0.