Some thought about Video playback on RecyclerView

Some thought about Video playback on RecyclerView

Talk about problem/solution, focusing on a modern UI/UX concept where list view contains various type of content, and each of them need to response to the User behaviour.

F8ca3e94570e4dc117f34563687a3b09?s=128

Nam Nguyen Hoai

October 25, 2017
Tweet

Transcript

  1. 2.

    About me Nguyen Hoai Nam (ナム) • :SBクラウド* • Github:eneim

    • Twitter:ene__im • Lang:vi, en, jp, java, js, kotlin • Android:by hobby & OSS contributor, interested in performance, proof of concept, ... * Cloud Engineer
  2. 4.

    Modern UI/UX: rich, responsive • List contains various types of

    content, including Text, Video, Gif, Image, … ◦ Eg: Facebook frontpage, Twitter timeline, Instagram, etc • Responsive to User’s scroll ◦ Auto playback start/pause, animation, etc. → Want to create one? the problems: ◦ 1. No obvious/official solution. ◦ 2. Existing solutions may not so easy to use. ◦ 3. Existing solutions may not well respect the Lifecycle.
  3. 5.

    How to: a brainstorming • No obvious/official solution → Create

    one • Existing solutions are not easy to use → Create one easy to use ◦ Easy to use = less effort to integrate, maintain, scale, test . • Existing solutions do not respect the Lifecycle → Create one that does ◦ Respect the Lifecycle = ? → TBD ◦ Lifecycle is not everything → Respect the Lifecycle on Demand (Customizable)
  4. 6.

    Problem: the Lifecycle Created Destroyed Attached to Window Detached from

    Window View’s lifecycle review Lives a complicated Life System Interactions User Interactions Self Behaviours
  5. 7.

    Problem: the Lifecycle + α • Configuration Changes (Recreation) ◦

    Window size change ◦ Orientation change ◦ ... • UI behaviour Changes (Non Recreation) ◦ Visibility change ◦ Focus change ◦ Scroll state change ◦ ... • Others changes made by User ◦ Network status change ◦ Permission change ◦ ... • Anything else ◦ Device spec ◦ OS spec ◦ Business level spec ◦ Player APIs
  6. 8.

    Toro v3: a proposal ➔ ✅ Solve the minimum problem

    ◆ Responsive to User scroll, auto start/pause. ➔ ✅ Respect stuff on demand ◆ Respect to the Lifecycle, respect to UI change, etc ➔ ✅ Easy to use ◆ Easy as write an xml + a Custom ViewHolder. ◆ Complicated setup is backed by a rich feature Demo App (= Copy/Paste ready). ◆ Advanced usage ready (also Copy/Paste ready by Demo App) ➔ ❎ Testable → Not yet ◆ 4.x+ or maybe 5.x+ ...
  7. 9.

    How Toro solves the problems? • Container (extends RecyclerView) ◦

    Hook into important events with care: ▪ State save/restore ▪ Window visibility change ▪ Child attach/detach • PlayerSelector ◦ Flexible playback selection • ToroPlayer ◦ Playback interface ◦ Straightforward implementation ◦ Rich feature Demo, Copy&Paste Ready • CacheManager ◦ Control playback state save/restore ◦ Optional, On Demand • ToroLayoutManager ◦ Interface for custom LayoutManager to follow • Copy&Paste ready ◦ Rich feature Demo App, Youtube included • Player API: ExoPlayer 2 ready (helpers)
  8. 10.

    Appendix • How to create Screen record with Device Frame?

    ◦ https://paul.kinlan.me/android-screen-recording-and-device-framing/ ◦ https://gist.github.com/eneim/d30952c2f6544a75c56a1791b01f81ac • A brief introduction into Toro ◦ https://eneim.github.io/2017/07/09/toro-101-how-to-1/