Blog | Sitemap | Forum

Bookmark using any bookmark manager!

Customize skinning flash video player for web
Customize flash video player in the easiest way

Insert video-ads into a video

To monetize the videos, player users might like to add some ads to them. PlayerDIY Web Player offers many solutions for making ads of video, image, text or html inside or over videos. Here, this article will show how to implement the following demo, which has two ads (one is about PlayerDIY Web Player at begin, the other is about PlayerDIY SWF to Video Converter at end) inside a video.

Examples about implementing the demo above by using PlayerDIY Web Player, XML code and flashvars code:

  • PlayerDIY Web Player
  • Flashvars Code

Step 1: Open PlayerDIY Web Player and input a video into it.

Step 2: Click the “Add” button on “insert” tab on “Advertise” interface, check the “video” or “swf” option, and then input an video(flash video or SWF file is available)

Set at which time this video-ad will start, how long it will last and where it will link to (if don’t want to link to any website, just leave the form of “Navigation on click” blank). Notice: insert ad during video playing, you could get the current-time point.

Step 3: Set the value of “Video list style” is none to remove the playlist and the embed code and URL area at the right of player.

Step 4: Click the “Publish” button on “Publish” interface and, then we can get the above demo for website.

The video-ads in the above demo also can be implemented with xml code and flashvars code.

XML Code:
To insert an ad into a video with xml code, all need to do is inserting a line of xml code about it into the medialist.xml file which published with the player. The lines of the red code below are the xml code about the video-ads which in the above demo, the value of each property in the code can be modified in the way you want to.

<?xml version="1.0" encoding="UTF-8"?>
<playitem caption="Ice Age III" path="Ice%20Age%20III.flv" image="Ice%20Age%20III.png" options="" clickurl="" clicktarget="_blank" endurl="" styleoftarget="browser" endtarget="">
<advertitem position="00:00:00:000" duration="00:00:14:200" videotype="flv" filepath="Web%20Player.flv" clickurl="" clicktarget="_blank" sound="0" fadein="1" fadeout="0" options=""/>
<advertitem position="00:02:24:014" duration="00:00:30:000" videotype="flv" filepath="swf%20to%20video.flv" clickurl="" clicktarget="_blank" sound="0" fadein="1" fadeout="0" options=""/>


Flashvars Code:
If you have published a player with an embedded xml file and have no the medialist.xml file, inserting an ad into a video, you need to insert a line of flashvars code into the embed code of the player. The syntax of the flashvars code as below:


Note: 1. No line break of the flashvars code; 2. When videoidx=0, it stands for the first video; 3. The "…" part means the front code can be duplicated to insert multiple ads into a single or mutilple videos.

The embed code of the above demo:

<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent" align="center"></div>
<script type="text/javascript">
var so = new SWFObject('mwplayer.swf','player','500','450','9');
/*no line break here*/

The lines of the red code are the flashvars code for inserting the two video-ads into the first video.