toro icon indicating copy to clipboard operation
toro copied to clipboard

Pause selected & playing video on explicit PlayerView event

Open smelfungus opened this issue 6 years ago • 7 comments

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!

smelfungus avatar Jun 27 '18 06:06 smelfungus

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 avatar Jun 27 '18 07:06 Davidvete

@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

smelfungus avatar Jun 27 '18 08:06 smelfungus

@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 :-?.

eneim avatar Jun 27 '18 08:06 eneim

@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?

eneim avatar Jul 05 '18 12:07 eneim

@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 avatar Aug 18 '18 02:08 eneim

@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!

smelfungus avatar Aug 20 '18 11:08 smelfungus

@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.

eneim avatar Aug 20 '18 12:08 eneim