How to know if ad is playing
Closed this issue · 1 comments
I noticed that on this page there is a state so we know if an ad is playing. It appears to be android only. Is there some other mechanism available for this in YoutubeKit?
Great framework BTW.
onAdStarted
on Android Player API is now deprecated.
YoutubeKit is a wrapper library for using YouTube's Web Player API on iOS, and it does not provide a direct feature to know if an ad is playing. However, there are several ways to indirectly know the playback state of ads.
-
Monitor the player's state: YoutubeKit provides a feature to send notifications when the state of the player changes. You can use this to perform some action when the player enters a buffering state or when playback is paused. However, this does not directly indicate that an ad is playing, but is an indirect indicator.
-
Use the YouTube Data API: You can use the videos.list method of the YouTube Data API to obtain detailed information about the video. This may include information about whether the video contains ads. However, this also does not directly indicate that an ad is currently playing.
By using these methods, you can have some understanding of the playback state of ads. However, a feature to definitively know if an ad is playing is not currently provided in YoutubeKit.