You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 RecyclerView where 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 RecyclerView takes 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?
The text was updated successfully, but these errors were encountered:
The best approach would be keep one player instance and use it. If you spin off multiple players, there will be time wasted in things like codec init; and you might run out of available codec.
Please also ref #8189 and #867, there are many useful discussions.
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:
RecyclerView
where each item has a video. Only one video should play at a time as the user scrolls down (the first fully visible one).RecyclerView
takes you to a second page where I want to continue playing the video where it left off on the first page.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?The text was updated successfully, but these errors were encountered: