Examples

Simple VAST Integration

Preview

Code

copy

<div id="ad-container"></div>
<script>
		 window.srAsyncInit = function() {
		 	SR('ad-container', {
		 		partnerID: 'your streamrail api key',
		 		muted: true,
		 		autoplay: true,
		 		contentAutoplay: true,
		 		content: {
		 			linkUrl: 'http://www.streamrail.com/',
		 			url: 'https://www.streamrail.com/videos/new/bg.mp4'
		 		},
		 		ads: {
		 			schedule: [{
		 				position: 'pre-roll',
		 				server: {
		 					tag: 'https://cors.streamrail.com/get?url=https://sdk.streamrail.com/demos/vast/nissan.xml'
		 				}
		 			}]
		 		}
		 	});
		 };

		(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>