title: Using ExoPlayer in a RecyclerView - the official way
body: <p>I wanted to know if there is a working sample for using <code>ExoPlayer</code> in a <code>RecyclerView</code> ?
  All examples I have found is based on using <code>ExoPlayer</code> with one view (<code>PlayerView</code>) but there is no sample for beginners out there demonstrating how to use <code>ExoPlayer</code> in a <code>RecyclerView</code> environment where the views can get attached or detached from the visible screen. </p>
  
  <p>Why is that so ? Why is it so difficult to integrate <code>ExoPlayer</code> into the <code>Android Framework</code> ecosystem so that we can use it without re-inventing the wheel. It's fair to assume that listing videos in a list is a common requirement but there is no guideline or whatsoever to help Android App developers. The very few "hints" and "solutions", living in the internet out there, are in most cases just a pain in the ass.</p>
  
  <p>The only useful sources I have found are these: </p>
  
  <ol>
  <li><a href="https://github.com/google/ExoPlayer/issues/867" rel="nofollow noreferrer">github discussion thread</a> (which I don't use because everytime I use "non-official" solutions, my apps crash for some reason, therefore I always prefer "official" solutions provided by Google)</li>
  <li>and this <a href="https://codingwithmitch.com/blog/playing-video-recyclerview-exoplayer-android/" rel="nofollow noreferrer">blog entry</a> (which I can't use because I use the latest
  Android Architecture Components like <code>Paging</code> with <code>PagedListAdapter</code>, <code>Room</code> for offline caching, <code>LiveData</code>, etc. etc. which do not fit very well with that approach).</li>
  </ol>