Examples

Google IMA SDK

Preview (pre-roll, mid-roll, post-roll)

Code

copy

<div id="ad-container"></div>
<script>
		 window.srAsyncInit = function() {
		 	var imaUrl = 'http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&' +
	        'iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&' +
	        'impl=s&gdfp_req=1&env=vp&output=xml_vmap1&unviewed_position_start=1&' +
	        'cust_params=sample_ar%3Dpremidpostpod%26deployment%3Dgmf-js&cmsid=496&' +
	        'vid=short_onecue&correlator=';

	        SR('ad-container', {
	            partnerID:'api-docs',
	            companion: false,
	            autoplay: true,
	            viewability: true,
	            content: { // optionally show a content video after the ad
	                url:'https://sdk.streamrail.com/demos/debugger/nasa_is_with_you_when_you_fly.mp4',
	                id: 'nasa_is_with_you_when_you_fly.mp4',
	                title: 'Nasa Video',
	                description: 'Cool video by nasa',
	                keywords: 'space,nasa',
	                categories: 'science'
	            },
	            ads: {
	                ima : {
	                    url : imaUrl    
	                }
	            }
	        });
		 };

		(function(d, s, id){
		 var js, fjs = d.getElementsByTagName(s)[0];
		 if (d.getElementById(id)) {return;}
		 js = d.createElement(s); js.id = id;
		 js.src = "https://sdk.streamrail.com/player/sr.ads.js";
		 fjs.parentNode.insertBefore(js, fjs);
		}(document, 'script', 'streamrail-jssdk'));
</script>