@eneim eneim released this Jun 25, 2017 · 396 commits to dev-v3 since this release

Assets 2

Toro 3.0 is a completely rewritten version of Toro. I borrow just a few helper from 2.x.

Toro 3.0 removes the use of static setup (Toro.attach/detach/init/register/unregister ...), which was a burden for both maintainer and users. Instead, all the necessary logic is put into Container - an empowered RecyclerView. The fact is, in the RecyclerView eco-system (RecyclerView, Adapter, LayoutManager, ViewHolder, ...), RecyclerView is the least likely to be customised. With that, I put my effort to integrate the beauty of Toro 2.x into a single RecyclerView. As a result, user just need to replace their RecyclerView with Container view to have the support from Toro.

Also, there is no need to implement the MediaPlayerManager which is tight to Adapter in Toro 2. I was struggling with this constraint for a long time after the release, and finally I know it must be removed. In Toro 3, there is no customisable MediaPlayerManager, its logic is instead integrated inside Container.

What user still need to do, is to implement the Player interface into the ViewHolder. This is a must, since there is no other way the Container could know if it is talking to a Player or not. But instead of dozens of methods in Toro 2.x, the ToroPlayer interface now contains only a few methods which are enough to control the playback, and few more for the callback from the playback update.

Deep inside the implementation, Toro 3.0 is no longer listen to Playback state. In fact, it was a pain in my ass when I try to follow the state machine of 3 Media player APIs (MediaPlayer, ExoPlayer 1, ExoPlayer 2) to tell Toro instance to deal with a Player when it is ready to play or when it completes the playback. In Toro 3.0, it is now just asking the Player to initialize the resource for playback, and then start it, or pause it, on demand. All the playback state update is ignore by Toro, and users will have the freedom to integrate their own callback logic.

This also asks the users more to handle the callback by themselves, so in fact, I put 2 helpers classes to help them getting start with Toro 3.0 easier. Right now only ExoPlayer 2.+ and Android MediaPlayer are supported. And there will be no plan to support more playback SDK. But as users will need to implement 3rd party SDK such as Youtube, Video, etc, I'm always try to help as much as possible.

More detail about how to use Toro 3.0 alpha 1 can be found in README as well as the sample app. So it is highly recommended to go though the README as well as app module before asking for any implementation details.

What happens with Toro 2.x: I will try to answer as much as possible, and fix fatal issues only. All up coming development will go to 3.+ and so on.