title: Videoview (Exoplayer) in a recycler view plays for the first time but when I scroll down and come up the video fails to play
body: <p>I am trying to implement an Instagram like recycler view in a fragment which shows Images and Videos. The images work fine. The videoview too works fine for the first time. But when I scroll down and the video view is removed from the displayed elements and then scroll back up, the video does not play.</p>
  
  <p>Pretty sure the videoview isn't being initialized the second time.</p>
  
  <p>What can I do to make it work?</p>
  
  <p>Also when exactly is the onBindViewHolder called?</p>
  
  <pre><code>   class PostListAdapter(var posts: ArrayList&lt;Post&gt;) :
      RecyclerView.Adapter&lt;PostListAdapter.PostViewHolder&gt;() {
  
  
  override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = PostViewHolder(
  
  
          LayoutInflater.from(parent.context).inflate(com.example.mehfil.R.layout.item_post_v2, parent, false)
  
      )
  
      override fun getItemCount() = posts.size
  
      override fun onBindViewHolder(holder: PostViewHolder, position: Int) {
          holder.bind(posts[position])
  
  
      }
  </code></pre>
  
  <p>
  My bind method looks like this...</p>
  
  <pre><code>  fun bind(post: Post) {
  
          if(post.type!!equals("video")) {
              //trigger video
              imageView.visibility = View.GONE
              videoView.visibility = View.VISIBLE
              try {
                  videoView.setSource("mp4 video link")
              } catch (E: Exception) {
                  Log.d("Video Error", E.toString())
              }
          }
          else
          {
              videoView.visibility=View.GONE
              imageView.visibility=View.VISIBLE
              //trigger images
              if(post.media!= null)
          {
              if(post.media!!.indexOf("http:")!= -1)
                  post.media=post.media!!.replace("http","https")
              imageView.loadImage(post.media , progressDrawable)
              Log.d("Media link ",post.media)
          }
  
                         }
  </code></pre>