toro
toro copied to clipboard
Pause selected & playing video on explicit PlayerView event
Hi there, @eneim! Is there any elegant solution to pause currently playing item(s) in case user is commanding another visible & selected item's PlayerView to start playback explicitly via controller for instance? Intercepting this event and notifying selected ToroPlayers doesn't look like nice approach. Do you have any ideas here? Thank you!
Loop through the recycler view that has the list of videos then pause them individually. Here is a snippet of my Kotlin code that does the same: val activePlayers = timelineRecyclerView.filterBy(Container.Filter.PLAYING) activePlayers .filterIndexed { index, item -> index != adapterPosition && item.playerView !== simpleExoPlayerView } .forEach { it.pause() }
@Davidvete so that's it, I'm not happy with that approach and wondering if that's possible to solve it with PlayerSelector or something :D
@DummyCo @Davidvete let me think about this. At the moment, it can think of container#filter()
where you can get all current playing items, and then manually pause expected ones. But with this, once user scroll or just interact with the screen, it will refresh them all. Will see what I can do :-?.
@DummyCo trying a few options including a custom ControllerDispatcher, what I'm wondering now is how to pack from 'manual control' to 'automatic control'. The behaviour is tight to UX, which is close to your app's requirement actually. Do you have some idea about how you would like it to behave?
@DummyCo @Davidvete Long time no update, can you take a look at this commit and see if it works in your case?
You can clone this branch https://github.com/eneim/toro/tree/nam/v3/selective-playback-360 as well. As it is a part of my upcoming release, you may experience some huge code change as well ...
@eneim sorry for such long response pause, there was no chance to check it out, will give a feedback ASAP. Thank you so much for all the participation!
@DummyCo It is fine. In fact I just make some update for this few days ago >.<. Would like to have this as an option for next release as well.