Skip to content

4. MediaPlayerManager: Toro's left hand

Nam Nguyen Hoai edited this page Oct 23, 2016 · 1 revision

MediaPlayerManager provide a simple interface for Toro to handle playback. It was created with the following targets:

  • Be able to control the playback state: start/pause and its progress.

  • Could smartly save a player's playback state (a Map of video's unique Id and last playback position) and use them to re-use later.

Since there are many ways to handle that kinds of concept, I let users decide their own implementation. But still, I prepare a built-in MediaPlayerManagerImpl.

Custom MediaPlayerManager

  • In case users want to have their own MediaPlayerManager, Toro expects that the implementation happens in an RecyclerView#Adapter because Adapter creates and controls the ViewHolders, its knows them best. Furthermore, it stays so close to the Parent's RecyclerView so Toro don't want to break that relationship.
public class MyAdapter extends ToroAdapter implements VideoPlayerManager {
   // Other required stuffs 
}

Clone this wiki locally