Android-youtube-player: how to pause or start programmatically?

Created on 19 Oct 2018  路  7Comments  路  Source: PierfrancescoSoffritti/android-youtube-player

I'm using your library in recycler view but i cant pause or starts video with code.

How to do that?

question

All 7 comments

You can call play and pause on YouTubePlayer.

I know that functions but they dont come up?

picture:

https://imgur.com/a/ebZcEgR

You are using a YouTubePlayerView, not a YouTubePlayer. Quick Start, YouTubePlayerView, YouTubePlayer.

But whenever i want to play/pause video i have to re-intialize the video? am i right?

If i'm wrong can you give me an example code?

I'm sorry if this questions are dump but i'm a newbie and my english is not so well.

No worries.

No, you don't need to re initialize every time you play/pause.
You can find a RecyclerView example here in the sample app.

that helped a lot thanks.

You're welcome!

If you find the library to be helpful consider leaving a star on GitHub :)

Was this page helpful?
0 / 5 - 0 ratings