Android-youtube-player: Detecting Advertisements

Created on 28 Jan 2019  路  4Comments  路  Source: PierfrancescoSoffritti/android-youtube-player

What way is there to detect an advertisement?
I noticed "onApiChange()" is called for advertisements, but I haven't managed to reproduce it enough times in order to count on it, also, it is sometimes called when there are no advertisements at all.

How can one detect that an ad is currently/started playing, instead of a video?
(For reference, the Android Youtube SDK has an "onAdStarted()" call)

enhancement

Most helpful comment

Well, that's unfortunate. Thanks for the quick response and I hope this issue is solved soon.

All 4 comments

Hi, unfortunately at the moment the YouTube IFrame API doesn't expose any API for ads events. Therefore there is no way (without using some hacks) to detect when an ad starts playing.

Well, that's unfortunate. Thanks for the quick response and I hope this issue is solved soon.

Hello PierfrancescoSoffritti,
The youtube advertisement seems to be disabled. Is there any way to play advertisements?
Thanks!

Hi, that's controlled by the IFrame API and it's not configurable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hannojg picture hannojg  路  4Comments

rajeefmk picture rajeefmk  路  5Comments

cnbcyln picture cnbcyln  路  8Comments

raghavsatyadev picture raghavsatyadev  路  9Comments

mankidal19 picture mankidal19  路  8Comments