Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

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 .

1 Community Answers

Todd

JW Player Support Agent  
0 rated :

I saw this same question on Stack Overflow, but I will reply here as well.

You cannot provide the contents of the VAST tag in that parameter. You must only give the URL to the VAST tag in the tag: ’’ parameter.

This question has received the maximum number of answers.