Publisher » PUB - Tutorials

ID #1029

AdultVideoScript How to setup JWPlayer and show video player ads in AVS?

 

 

Setting Up JWPlayer in AVS (AdultVideoScript)

 

Adult Video Script 2.1 comes with JWPlayer3 as an alternative video player, but it's not setup as default. Here’s is a simple howto on how to integrate the JW Player with Adult Video Script (removing the AVS flash player).

 

IF YOU ARE USING MOD_SECDOWNLOAD AND LIGHTTPD, READ ADVANCED CONFIGURATION AT THE END.

 

Confirm that the JWPlayer file is on the server

 

You can verify if the file is were it should be. Look for the file  /WHERE/AVS/IS/INSTALLED/media/player/player_adv.swf

If the file is not there, you can get the player from http://www.longtailvideo.com/players/jw-flv-player and place the flash player file on your server.

 

Create the Video Player template

 

In the directory  /WHERE/AVS/IS/INSTALLED/templates/frontend/CURRENTLY-USED-TEMPLATE/ , create the file video_jwadx.tpl and add these lines:

<script type='text/javascript' src="{$relative_tpl}/js/swfobject.js" mce_src="{$relative_tpl}/js/swfobject.js"></script>
<script type='text/javascript'>
var s1 = new SWFObject('{$relative}/media/player
/player_adv.swf','player','630','500','9'); s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','transparent');
s1.addVariable('autostart','true');
s1.addVariable('bufferlength', '3');
s1.addVariable('file', '{$baseurl}/media/videos/flv/{$video.VID}.flv');
s1.addVariable('streamer', 'lighttpd');
s1.addVariable('id', 'player');
s1.addVariable('token', 'K49sS9q0');
s1.addVariable("stretching", "uniform");
s1.addVariable('javascriptid','player');
s1.addVariable('enablejs','true');
s1.write('player');
</script>

If you modified your template, don't forget to configure the proper dimension for the flash player. Also, if you are using the lighttpd module to protect your content, you need to update the token.

 

Setup your template to use the new player

 

Edit /WHERE/AVS/IS/INSTALLED/templates/frontend/CURRENTLY-USED-TEMPLATE/video.tpl and
replace following line:

{include file='video_vplayer.tpl'}

with (look for all instances):

{include file='video_jwadx.tpl'}


Test your site to confirm new player work

 

The JwPlayer should now be used to display your movies. Make sure everything works the way you expect.

 

Configure AdXpansion video ads to display in your player

 

Once you are certain the video player works properly, you can make the necessary changes to the file /WHERE/AVS/IS/INSTALLED/templates/frontend/CURRENTLY-USED-TEMPLATE/video_jwadx.tpl , you can refer to the instruction given in the other tutorial to get the proper code to add to your template. The final file should look like this:

<script type='text/javascript' src='
http://ads.adxpansion.com/public/js/showads.php?zone_id=9999&ver=1&type=jwplayer">

<script type='text/javascript' src="{$relative_tpl}/js/swfobject.js" mce_src="{$relative_tpl}/js/swfobject.js"></script>
<script type='text/javascript'>
var s1 = new SWFObject('{$relative}/media/player/player_adv.swf','player','630','500','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','transparent');
s1.addVariable('autostart','true');
s1.addVariable('bufferlength', '3');
s1.addVariable('file', '{$baseurl}/media/videos/flv/{$video.VID}.flv');
s1.addVariable('streamer', 'lighttpd');
s1.addVariable('id', 'player');
s1.addVariable('token', 'K49sS9q0');
s1.addVariable("stretching", "uniform");
s1.addVariable('javascriptid','player');
s1.addVariable('enablejs','true');
s1.write('player');
</script>

 

Advanced Configuration with mod_secdownlaod and lighttpd

 

If you are using mod_secdownload to prevent htlinking of your movies, you need to create a new configuration file. That can be done easily. You need to copy the file /WHERE/AVS/IS/INSTALLED/MEDIA/PLAYER/config.php to configjw.php

Edit the new file configjw.php, replace toward the end everything that start with <xml> and end with </xml> with:

 <config>
<file><?php echo $SD_URL; ?></file>
<image><?php echo $config['TMB_URL']. '/' .$video_id. '/default.jpg' ?></image>
<autostart><?php echo $player['autorun']; ?></autostart>
<bufferlength><?php echo $player['buffertime']; ?></bufferlength>
<?php if ($config['lighttpd'] == '1'): ;?>               
<streamer>lighttpd</streamer>
<?php endif; ?>
<stretching>uniform</stretching>
</config>

 

In the directory  /WHERE/AVS/IS/INSTALLED/templates/frontend/CURRENTLY-USED-TEMPLATE/ , create the file video_jwadx.tpl and add these lines:

<script type='text/javascript' src='
http://ads.adxpansion.com/public/js/showads.php?zone_id=9999&ver=1&type=jwplayer">

<script type='text/javascript' src="{$relative_tpl}/js/swfobject.js" mce_src="{$relative_tpl}/js/swfobject.js"></script>
<script type='text/javascript'>
var s1 = new SWFObject('{$relative}/media/player/player_adv.swf','player','630','500','9');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','transparent');
s1.addVariable('config', '{$baseurl}/media/player/configjw.php?vkey={$video.VID}');
s1.addVariable('id', 'playeradx');
s1.addVariable('javascriptid','playeradx');
s1.addVariable('enablejs','true');

</script>

 The lines in italic are only required for jwplayer 3.

 

Edit /WHERE/AVS/IS/INSTALLED/templates/frontend/CURRENTLY-USED-TEMPLATE/video.tpl and
replace following line:

{include file='video_vplayer.tpl'}

with (look for all instances):

{include file='video_jwadx.tpl'}

 

 

Tags: -

Related entries:

Last update: 2011-03-22 13:18
Author: AdXpansion Admin
Revision: 1.3

Digg it! Print this record Send to a friend Show this as PDF file

You cannot comment on this entry