user16489264
user16489264

Reputation:

how can set media play controller in layout?

how can set media play controller in layout?

when I slider the recycleview, the media play controller cannot hold in layout, how can setting it?

Upvotes: 0

Views: 76

Answers (1)

Aasima Jamal
Aasima Jamal

Reputation: 119

In RecyclerView Adapter 1) Initialize the context

`    private var context: Context? = null

`

  1. Then pass the context with parent in onCreateViewHolder

    `

     context=parent.context
    

`

3)set the mediacontroller in BindViewHolder along with context

 ` val mediaController = MediaController(context);
    mediaController.setAnchorView(holder.video11);
   holder.video11.setMediaController(mediaController);
    holder.video11.start()`

Upvotes: 0

Related Questions