Ads


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".

  • tag should contain a URL string variable which is a reference to the advertisment that will be played.
  • offset should contain the time in the video that the advertisment will be played, and in can be represnted in one of several ways:
    • Number: which would play the adverstisment after the specied number (in seconds) has passed in the video. For example, setting offset to 33 would mean that the add will play at second 33 of the video.
    • String timestamp: a specified timestamp string representation can be added in a string format, which will tell the player to play the ad at that exact time in the video. The timestamp string should following the following format: "hh:mm:ss.ms". For example, setting offset to "01:23:54.435" will play the add at that exact time in the video.
    • String 'pre': this will play the advertisment before the video starts.
    • String 'mid': this will play the advertisment at exactly in the middle of the video. If the video length has an uneven number of seconds, it will round the number to the next second.
    • String 'pos': this will play the advertisment after the end of the video.

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