10up / brightcove-video-connect

A plugin to integrate your Brightcove video library or libraries with WordPress
https://www.brightcove.com/
GNU General Public License v2.0
22 stars 34 forks source link

Paginated results in the Brightcove Media Modal #396

Open shreyasikhar opened 4 months ago

shreyasikhar commented 4 months ago

Is your enhancement related to a problem? Please describe.

Brightcove Media modal fetches the latest 100 videos in the modal in one request by default.

In order to optimize the performance of Brightcove API calls, we wanted to fetch lesser posts with a support of paginated query, so that the next paged request should trigger with next set of results when user clicks on load more videos button or scrolls to the end whichever way possible.

Currently, we can reduce the posts per page using the filter brightcove_posts_per_page, but we can't fetch the results from the next page.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

shreyasikhar commented 4 months ago

We have explored the codebase and found out that the implementation for paginated results is added on JS scroll event, but for some reason the event callback is not getting called.

This is the file where we found the event: https://github.com/10up/brightcove-video-connect/blob/develop/assets/js/brightcove-admin.js#L1533

Please someone check this. cc: @oscarssanchez If you can help here.

Sidsector9 commented 4 months ago

This is because the element #brightcove-media-frame-content doesn't have a fixed height which is why the scroll event is not working.