youtube-ios-player-helper icon indicating copy to clipboard operation
youtube-ios-player-helper copied to clipboard

'-[YTPlayerView playerState]: unrecognized selector sent to instance 0x7f98617bdc60'

Open nihp opened this issue 2 years ago • 2 comments

reason: '-[YTPlayerView playerState]: unrecognized selector sent to instance 0x7f98617bdc60'

Getting the below error and unable to play the video in iOS

 YTPlayerView* videosWebView;
 YTPlayerState playerState = videosWebView.delegate;

player state is empty

nihp avatar Mar 08 '22 11:03 nihp

Hi @nihp ,

The code snippet seems incorrect to me, specifically YTPlayerState playerState = videosWebView.delegate; This wouldn't work because delegate is an instance of YTPlayerViewDelegate.

You should be using the playerState (playerState) method instead.

brol1dev avatar Mar 09 '22 18:03 brol1dev

How can I add this and return the state. It would be helpful.

isPlaying = [videosWebView playerState] == kYTPlayerStatePlaying;

How can I handle the above with the completion handler. I am new to this,

nihp avatar Apr 28 '22 12:04 nihp