Demo THEOplayer

AdBlock detection

This page demonstrates how you can handle adblockers.

logo-01

Block THEOplayer from playing the content and/or show custom behavior

 
We noticed you are probably using an adblocker.
Please turn it off if you want to enjoy our content.

 

JavaScript code:

// set player
var element = document.querySelector('#video-container'),
    player = new THEOplayer.Player(element, {
        libraryLocation : 'http://cdn.theoplayer.com/dash/theoplayer/'
    });

// 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: 'http://amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest(format=m3u8-aapl)'
    },
    ads: [{
        sources: 'http://cdn.theoplayer.com/demos/advertisement/livereal-no-skip.xml'    
    }],
    // set this to true if you want to block the content
    // default value is false
    blockContentIfAdError: true
}

Still wasting time debugging video playback problems?

Welcome to cutting-edge video, delivered efficiently and on any platform. We think you're going to like it.