Tubitv / TubiPlayer

A media streaming video player based on ExoPlayer from google, with convenience methods for ad supported content
MIT License
95 stars 24 forks source link

Separate ui from logic #69

Closed allengotstuff closed 6 years ago

allengotstuff commented 6 years ago

Separate Control logic from UI in TubiPlayer:

The idea is that now you can create your own custom UI and give to TubiPlayer without have to understand the business logic, the player will display your UI instead. There is an object that you can get from DoublePlayerActivity, "getPlayerController()" returns the controller logic that you can hook up with your custom UI.

Three steps to give custom control UI to the TubiPlayer:

  1. create your own UI
  2. get the "UserController" from DoublePlayerActivity using getPlayerController(), then hookup your UI with logic
  3. finally, give your custom UI back to the DoublePlayerActivity by overriding addUserInteractionView() in the Activity.

Then everything will work

hm1113 commented 6 years ago

Very nice, this is much cleaner!