videojs-vast-plugin

2018-08-11 admin

videojs-vast-plugin是什么

什么是videojs-vast-plugin,A VAST plugin for VideoJS

videojs-vast-plugin介绍、videojs-vast-plugin使用

This plugin reads a VAST file, grabs the first video it can, and plays it as pre-roll advertisement before your video. It will also click through to whatever url the advertiser designates, track any clicks, and fire all of the correct pixel trackers at the right times.

Usage

Include the plugin and it’s dependencies:

<script src="http://vjs.zencdn.net/4.4.3/video.js"></script>
<script src="vast-client.js"></script>
<script src="video.ads.js"></script>
<script src="videojs.vast.js"></script>

Add “ads” and “vast” to the plugins object, and pass a url:

plugins: {
    ads: {},
    vast: {
        url: 'http://url.to.your/vast/file.xml'
    }
}

And when you play that video, a pre-roll ad should play beforehand.

If you click on the ad, an adclick event will trigger.

Check out the demo for a more detailed example.

This plugin is technically an integration for video.js’s ads plugin. For more information on the various states in the preroll process, please refer to the videojs-contrib-ads documentation.

Options

  • url: a URL to the xml file.
  • skip: how long until the user can skip the ad. Defaults to 5, and a negative number will disable it.

Credit

This plugin uses dailymotion’s vast client to read and parse the VAST files, and video.js’s ads plugin for switching from pre-roll to content.

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-37738.html

文章标题:videojs-vast-plugin

回到顶部