-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Labels
Description
I have a fairly complicated use case. I'm not looking for specific code, but more high-level technical help about how to best approach this situation.
Here is how I would like my app to work:
- The main page of my app is a
RecyclerViewwhere each item has a video. Only one video should play at a time as the user scrolls down (the first fully visible one). - Tapping on a video in the
RecyclerViewtakes you to a second page where I want to continue playing the video where it left off on the first page. - When going back from the second page to the first page, the video should continue playing where it left off on the second page.
- I have several other pages where I would also like to play a video/videos.
From my readings, for performance reasons, it sounds like I should only be creating one instance of ExoPlayer and passing it around.
So my question is, what is the best approach to handling a situation where I should only be creating one instance of ExoPlayer, and then be able to pass it between activities, fragments, adapters, etc.?
Should I create a Singleton where I handle all video player logic and pass that between pages as needed? Or should I go with a different approach?
Reactions are currently unavailable