Detecting changes in YTPlayer library

Recently I noticed this may not be such obvious, but if you need to know when user pauses video or resumes playback, just use:

and since there are constants like kYTPlayerStatePlaying or kYTPlayerStatePaused  you can just do:

but to make it work, do not forget to set proper delegate:

and add YTPlayerViewDelegate in your header file for view controller:

There are also few other useful methods:

so there is pretty easy to handle most of player behavior.

Leave a Reply