Skip to content

Instantly share code, notes, and snippets.

@serefyarar
Last active August 29, 2015 14:22
Show Gist options
  • Save serefyarar/c0f5659e0c58c9ac936c to your computer and use it in GitHub Desktop.
Save serefyarar/c0f5659e0c58c9ac936c to your computer and use it in GitHub Desktop.
final.
function Advertisement(category,media_id,frequency,duration){
this.category = category,
this.media_id = media_id;
this.frequency = frequency;
this.duration = duration;
this.getAds = function(){
var ads = [{time : 0, adTagUrl : this.getVast("preRoll")}];
var midrollCount = parseInt(this.duration/this.frequency);
for(i=1;i<=midrollCount;i++){
var midroll = {
time : i*this.frequency,
adTagUrl : this.getVast("midRoll"+i)
};
ads.push(midroll);
};
ads.push({time : -1, adTagUrl : this.getVast("postRoll")});
return ads;
};
this.getVast = function(identifier){
return 'http://www.vomedia.tv/AdServer/mobile.php?category='+this.category+'&mediaid='+this.media_id+'&channel='+this.channel+'&publisherid=vidivodo&viewType?'+identifier;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment