Flowplayer · Mid-roll video advert

This shows a video advert (mid-roll) at 3 seconds into the feature video.

Video adverts depend on what's available in the AdSense inventory and your region. Sometimes there may be no video advert matching the current criteria. As the inventory for image_text may be larger you should you should set the ad_type to "video_image_text" if you want to make sure that an advert is shown.


Include the required JavaScript and stylesheets. We recommend having these files on your own web server or the CDN your site is using.

<link rel="stylesheet" href="//releases.flowplayer.org/5.4.6/skin/minimalist.css">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//releases.flowplayer.org/5.4.6/flowplayer.min.js"></script>
<!-- load the AdSense assets after the Flowplayer assets -->
<link rel="stylesheet" href="//releases.flowplayer.org/asf/1.0.4/asf.min.css" media="screen">
<script src="//s0.2mdn.net/instream/html5/ima3.js"></script>
<script src="//releases.flowplayer.org/asf/flowplayer.org/1.0.4/asf.min.js"></script>


asf.min.js is the AdSense plugin for Flowplayer - you will get your own version of it when you sign up with our AdSense program. This plugin will be tied to your own AdSense account so that the ad impressions and clicks will be associated with your account, and the ad revenue will be assigned to you. This page uses flowplayer.org/1.0.4/asf.min.js which was built for the flowplayer.org domain and its subdomains.


The plugin is initialized with its flowplayer_ima.create() method. Here we create it for all players on the page by invoking it in the global flowplayer() function in the HEAD section of the page.

flowplayer(function(api, root) {
flowplayer_ima.create(api, root);



Player container and ads configuration

<!-- the player container -->
<div class="flowplayer" data-rtmp="rtmp://s3b78u0kbtx79q.cloudfront.net/cfx/st" data-ratio="0.4167">
<!-- AdSense for Video configuration.
Needs to be nested inside the player container div tag. -->
// optional adsense configuration
adsense: {
request: {
adtest: "on" // this is required when you are testing your installation
// adverts configuration
ads: [{
// 3 seconds into the feature ...
time: 3,
// ... we request an advert of type video with max duration of one minute
request: {
ad_type: "video",
max_ad_duration: 60000
<source type="video/webm" src="http://stream.flowplayer.org/bauhaus/624x260.webm">
<source type="video/mp4" src="http://stream.flowplayer.org/bauhaus/624x260.mp4">
<source type="video/ogg" src="http://stream.flowplayer.org/bauhaus/624x260.ogv">
<source type="video/flash" src="mp4:bauhaus/624x260">
</div> <!-- player container closes here -->


ad_type defines what types of ads will be requested and shown. Here we only show video adverts. If you don't specify the ad_type value at all it will show video, image and text ads because the default ad_type value is "video_image_text".

There are several other optional configuration options available. You can for example specify the maximum duration for video ads. See here for the full list of options. Note that you should not specify the full adTag in the adsense configuration when you use these. If you do, these options will be ignored. All these options should be included in the request object in the ads configuration.

AdSense for Flowplayer demos