This page demonstrates how you can handle adblockers. There are several options available:
JavaScript code:
// set player
var element = document.querySelector('#video-container'),
player = new THEOplayer.Player(element, {
libraryLocation : 'https://cdn.theoplayer.com/dash/theoplayer/',
license: ''
});
// add an eventlistener to get custom behavior if there is an ad error
player.ads.addEventListener('aderror', function (event) {
// do something
});
// set the player source with ads and the blockContentIfAdError property
player.source = {
sources: {
src: 'https://cdn.theoplayer.com/video/big_buck_bunny/big_buck_bunny.m3u8'
},
ads: [{
sources: 'https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator='
}],
// set this to true if you want to block the content
// default value is false
blockContentIfAdError: true
}