搜索:
向播放器添加插件
增加功能
使用说明
插件制作示例
监听动作插件
修改右键
修改/增加右键菜单
修改,添加右键

播放器广告单独文件配置说明

在查阅该文之前需要了解的内容如下:

调用播放器时的配置说明

调用播放器时的属性列表及相关说明

正文:

如果你决定使用一个单独的文件来配置广告,则需要在调用播放器的配置里设置advertisements:'website:广告配置文件路径'。

路径可以是静态也可是动态文件。返回的数据需要是json格式。广告的内容可以包含:前置广告,暂停广告,插入广告,结束广告,其它广告这五种类型。下面是一个完整的数据格式演示:

{
    "front": [
        {
            "file": "adv.mp4",
            "type": "mp4",
            "link": "http://www.ckplayer.com",
            "time": 15,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.swf",
            "type": "swf",
            "link": "",
            "time": 15,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.gif",
            "type": "gif",
            "link": "http://www.ckplayer.com",
            "time": 15,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.jpg",
            "type": "jpg",
            "link": "http://www.ckplayer.com",
            "time": 15,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        }
    ],
    "pause": [
        {
            "file": "adv.swf",
            "type": "swf",
            "link": "",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.gif",
            "type": "gif",
            "link": "http://www.ckplayer.com",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.jpg",
            "type": "jpg",
            "link": "http://www.ckplayer.com",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        }
    ],
    "insert": [
        {
            "file": "adv.swf",
            "type": "swf",
            "link": "",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.gif",
            "type": "gif",
            "link": "http://www.ckplayer.com",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.jpg",
            "type": "jpg",
            "link": "http://www.ckplayer.com",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        }
    ],
    "inserttime": "100,200",
    "end": [
        {
            "file": "adv.swf",
            "type": "swf",
            "link": "",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.gif",
            "type": "gif",
            "link": "http://www.ckplayer.com",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        },
        {
            "file": "adv.jpg",
            "type": "jpg",
            "link": "http://www.ckplayer.com",
            "time": 5,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php"
        }
    ],
    "other": [
        {
            "file": "adv.gif",
            "type": "gif",
            "link": "http://www.ckplayer.com",
            "startTime": 3,
            "time": 10,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php",
            "align": "center",
            "vAlign": "bottom",
            "offsetX": -200,
            "offsetY": -110,
            "about": "这是一个gif广告(宽400,高60),当播放器播放startTime=3秒时显示,time=10秒后结束,水平中间对齐align=center,并且在水平轴上向左边偏移200像素,垂直方向是底部对齐并且向上偏移110个像素"
        },
        {
            "file": "adv.swf",
            "type": "swf",
            "link": "http://www.ckplayer.com",
            "startTime": 3,
            "time": 10,
            "exhibitionMonitor": "exhibitionMonitor.php",
            "clickMonitor": "clickMonitor.php",
            "align": "right",
            "vAlign": "right",
            "offsetX": -60,
            "offsetY": -60
        }
    ]
}

这里将所有的广告都放在一个文件里管理。从上面的形式可以看出“暂停广告”和“其它广告”二种形式不支持视频格式的。“其它广告”类型的广告增加了一个位置设置的功能,有四个参数来定位。align=水平方向的对齐方式(left=左,center=中间,right=右),valign=垂直方向的对齐方式(top=上,middle=中,bottom=下),offsetX=水平偏移,offsetY=垂直偏移

另外这里还有一个属性是inserttime,是用来设置插入广告的时间点的设置。如果不设置,则以前端调用播放器时的初始化对象里的设置为准。

展示和点击监听功能

exhibitionMonitor:展示监听地址,如果这里设置了一个地址,则该广告显示时播放器会请求该路径并且将该广告的所有属性都一起做为补充参数以get请求的形式请求该地址。如果你需要其它的属性可以自行添加

clickMonitor:点击监听地址。跟exhibitionMonitor的原理一样。

Powered by ckplayer.com
Copyright©ckplayer,2011-2017( 苏ICP备11026158号 )