Last active
August 29, 2015 14:22
-
-
Save serefyarar/c0f5659e0c58c9ac936c to your computer and use it in GitHub Desktop.
final.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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