I am using YTPlayerView inside UICollectionView(Horizontal scroll) with one item visible at a time on the screen. I have added a UIView inside custom cell and changed the class name to YTPlayerView in Identity inspector. 
For YTPlayerView I have enabled AutoPlay and it is playing well. But, when I scroll to next or previous item I want to stop the player. I tried stopping the player in 'didEndDisplayingCell' by getting custom cell object with NSIndexPath. But YTPlayerView instance with custom cell object returns (null) in 'didEndDisplayingCell'. So I am not able to stop video play. How can I stop video play when scroll to next / prev item?
And I have 3 different custom UICollectionView cells to display text, images and videos (YTPlayerView or AVPlayer).
EDIT
I tried to get the custom video cell object in 'cellForItemAtIndexPath' by saving previous visible cell indexpath. And I am able to get the custom cell object, but when I try to get the instance of YTPlayerView it is returning new object for YTPlayerView.
Can anyone suggest me the right way to handle youtube videos in UICollectionView.