KWIKplayer includes full ads support. Adds can be added either individually or as preconfigured ad scheduls.
In order to include ads in the player, a JSON package under the name "advertising" needs to be added to the player JSON package.
advertising object contains a single JSON object under the key "schedule", which is where we will store our advertising schedule accordingly.
schedule object contains a collection of JSON objects containing the advertisments that should be shown in the video, with each object representing a single advertisment.
An advertisment object can be given a random key representing the advertisment break. and it should contain two keys: "offset" and "tag".
<script>
kwikMotion("player", {
sources: [ //video sources
{file: "https://clvod.itworkscdn.net/itwvod/smil:itwfcdn/admin/515002-R204MDrB22W6kG8.smil/playlist.m3u8"},
{file: "https://clvod.itworkscdn.net/itwvod/smil:itwfcdn/admin/515002-R204MDrB22W6kG8.smil/manifest.mpd"},
{file: "https://clvod.itworkscdn.net/itwvod/smil:itwfcdn/admin/515002-R204MDrB22W6kG8.smil/Manifest"}],
advertising: { //adding our advertisment object to the player, in order to make it play ads.
schedule: { //our advertisments schedule.
adbreak1: { //our first add break
offset: 'pre', //setting this ad to play before the video starts
//below we add our video link with the tag variable.
tag: 'https://pubads.g.doubleclick.net/gampad/live/ads?sz=400x225&iu=/38740535/AlTazaj-Pre&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=[referrer_url]&description_url=[description_url]&correlator=[timestamp]&432423'
},
adbreak2: { //our second adbreak
offset: '00:01:24:250', //this ad will play at exactly 1 minute and 24 seconds in the video
tag: 'https://pubads.g.doubleclick.net/gampad/live/ads?sz=400x225&iu=/38740535/AlTazaj-Pre&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=[referrer_url]&description_url=[description_url]&correlator=[timestamp]&433'
},
adbreak3: {
offset: 'mid', //this ad will play at exactly middle of the video
tag: 'https://pubads.g.doubleclick.net/gampad/ads?slotname=/124319096/external/ad_rule_samples&sz=640x480&ciu_szs=300x250&unviewed_position_start=1&output=xml_vast3&impl=s&env=vp&gdfp_req=1&ad_rule=0&vad_type=linear&vpos=preroll&pod=1&ppos=1&lip=true&min_ad_duration=0&max_ad_duration=30000&vrid=6496&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostpodbumper&url=&video_doc_id=short_onecue&cmsid=496&kfa=0&tfcd=0'
},
adbreak7: {
offset: 10, //this ad will play at 10 seconds in the video
tag: 'https://pubads.g.doubleclick.net/gampad/live/ads?sz=400x225&iu=/38740535/AlTazaj-Pre&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=[referrer_url]&description_url=[description_url]&correlator=[timestamp]&433'
},
adbreak4: {
offset: 'pos', //this ad wil play after the video ends
tag: 'https://pubads.g.doubleclick.net/gampad/ads?slotname=/124319096/external/ad_rule_samples&sz=640x480&ciu_szs=300x250&unviewed_position_start=1&output=xml_vast3&impl=s&env=vp&gdfp_req=1&ad_rule=0&vad_type=linear&vpos=postroll&pod=3&bumper=before&min_ad_duration=0&max_ad_duration=10000&vrid=6496&sb=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostpodbumper&url=&video_doc_id=short_onecue&cmsid=496&kfa=0&tfcd=0'
}
}
}
});
</script>