Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Explain on.AdBlock


Not much is given on how this function works.

The way I am trying to understand it:

If JWPlayer itself notices AdBlock, it will then allow me to do whatever with the discover?

playerInstance.on('AdBlock', function(e){
$("#trailer_addict_video_frame").html("<p>Go F*ck Yourself</p>");
});

So basically destroy the created video in favor of some message? Does JWPlayer have a guide/tutorial on a better implementation?

Cheers
Ryan

5 Community Answers

Randy

JW Player Support Agent  
0 rated :

Hello,

We do not have a specific article on adBlocking at the moment but it essentially should work to the affect that if the player detects an adBlocker in the browser, it will fire what ever code you tell it it. If it is to remove the player jwplayer().remove(); or simply fire an alert. That code should work for you. I’ve included an example that might work for you as a starting point:

<p id="myAlert">Was The Ad Blocked?</p>

playerInstance.on(“adBlock”,function(){console.log(“Ad blocked.”);document.getElementById(“myAlert”).innerHTML=“Ad was blocked. Please disable ad blocking to enjoy content.”;});

Hope that helps,
Randy

contact

User  
0 rated :

Okay, so does the playerInstance.on(“adBlock”,function() work even if a VAST isn't being called at the moment?

In short, does the function only work if advertising variables exist?

Cheers
Ryan

Randy

JW Player Support Agent  
0 rated :

Hello Ryan,

Let me get more specifics around this for you and circle back.

Randy

contact

User  
0 rated :

Thanks Randy.

Randy

JW Player Support Agent  
0 rated :

Hello Ryan,

This is the feedback I got from our player team. Hope this helps:

This event is fired when an ad plugin (Either VAST or Google IMA) is configured inside of the JW Player setup, and an ad blocker is detected on a viewer’s browser. It is then possible to request a user disable their ad blocker to proceed.

Randy

This question has received the maximum number of answers.