How to play ads in jwplayer
I need to play some ads before video play using jw player .
My code file :-
$res = '<?xml version="1.0" encoding="UTF-8"?>';
$res .= '<VAST version="2.0">';
$res .= '<Ad id="static">';
$res .= '<InLine>';
$res .= '<AdSystem>Static VAST Template</AdSystem>';
$res .= '<AdTitle>Static VAST Tag</AdTitle>';
$res .='<Impression>http://example.com/pixel.gif</Impression>';
$res .= '<Creatives>';
$res .= '<Creative>';
$res .= '<Linear>';
$res .= '<Duration>00:00:08</Duration>';
$res .= '<TrackingEvents>';
$res .='<Tracking event="start">http://example.com/pixel.gif</Tracking>';
$res .='<Tracking event="firstQuartile">http://example.com/pixel.gif</Tracking>';
$res .='<Tracking event="midpoint">http://example.com/pixel.gif</Tracking>';
$res .='<Tracking event="thirdQuartile">http://example.com/pixel.gif</Tracking>';
$res .='<Tracking event="complete">http://example.com/pixel.gif</Tracking>';
$res .='<Tracking event="pause">http://example.com/pixel.gif</Tracking>';
$res .='<Tracking event="mute">http://example.com/pixel.gif</Tracking>';
$res .='<Tracking event="fullscreen">http://example.com/pixel.gif</Tracking>';
$res .='</TrackingEvents>';
$res .='<VideoClicks>';
$res .='<ClickThrough>http://www.longtailvideo.com/</ClickThrough>';
$res .='<ClickTracking>http://example.com/pixel.gif</ClickTracking>';
$res .='</VideoClicks>';
$res .='<MediaFiles>';
$res .='<MediaFile type="video/mp4" bitrate="300" width="480" height="270">';
$res .='http://example.com/uploads/myPReroll.mp4';
$res .='</MediaFile>';
$res .='</MediaFiles>';
$res .='</Linear>';
$res .='</Creative>';
$res .='</Creatives>';
$res .='</InLine>';
$res .='</Ad>';
$res .='</VAST>';
jwplayer('primcast.com').setup({
file: 'http://localhost.com/live_stream/uploads/videos/test-video-107.mp4',
primary: 'flash',
advertising: {
client: 'vast',
tag: '<?php // echo $res ;?>'
},
width: 480,
height: 270
});
here $res contains the xml format of my ads video file .