15

这个问题的答案将不胜感激!

无论如何,这是我第一次看到 VAST 标记。现在,我们的想法是在没有或使用普通播放器的情况下运行/实现它。这是否可以仅通过使用 JavaScript 事件来完成?究竟如何?

标签如下所示: http ://example.com/www/delivery/vst.php?zoneid=000&id=website

<VAST version="2.0">
    <Ad id="VPAID">
        <InLine>
            <AdSystem version="1.0">AD COMPANY</AdSystem>
            <AdTitle>VPAID Ad Manager</AdTitle>
            <Impression/>
            <Creatives>
                <Creative sequence="1">
                    <Linear>
                        <Duration>00:00:15</Duration>
                        <MediaFiles>
                            <MediaFile delivery="progressive" width="640" height="480" scalable="true" type="application/x-shockwave-flash" apiFramework="VPAID">
                                <![CDATA[
                                http://example.com/www/admanager/AdManager.swf?zoneid=000&id=website&ft1=10&ft2=40&ft3=5&ft4=30&ft5=0.5&ft6=10&ft7=20&ht1=5&ht2=40&ht3=5&ht4=30&ht5=0.5&ljt=example.com&vtid=v_00000_hashid
                                ]]>
                            </MediaFile>
                            <MediaFile delivery="progressive" width="640" height="480" scalable="true" type="application/javascript" apiFramework="VPAID">
                                <![CDATA[
                                http://example.com/www/admanager/ad-manager.js#zoneid=000&id=website&ft1=10&ft2=40&ft3=5&ft4=30&ft5=0.5&ft6=10&ft7=20&ht1=5&ht2=40&ht3=5&ht4=30&ht5=0.5&ljt=example.com&vtid=v_00000_hashid
                                ]]>
                            </MediaFile>
                        </MediaFiles>
                    </Linear>
                </Creative>
            </Creatives>
        </InLine>
    </Ad>
</VAST>

4

2 回答 2

5

You can use Google's IMA SDK to handle the fetching and handling of the response. It's good for any standards-compliant VAST or VMAP, not just DFP.

You can use the IMA SDK without a video player if you do want. I've modified Google's getting started example here and removed the video element: http://jsbin.com/dosexa/edit?html,css,js,output

The container for the ad can be a div:

var adDisplayContainer =
new google.ima.AdDisplayContainer(document.getElementById('adContainer'));

The ads manager requires a video element (or something implementing some of a video element's API) but this can be an empty video element:

adsManager = adsManagerLoadedEvent.getAdsManager(document.createElement('video')); 

The example I've used there is VPAID, as in your example. There's a video ad tag commented out.

Using a pre-built integration with a player may still be simpler. Google provide a plugin wrapper to use the SDK with video.js.

于 2015-12-18T18:44:37.873 回答
2

是的,可以只使用 HTML5 完全在 Javascript 中实现 VAST,而无需专门的播放器。

例如,看看videojs-vast-plugin。它使用该项目解析 VAST 资源,然后使用videojs实际播放广告。它仅支持前贴片广告,但可以扩展以添加对其他类型广告的支持。

当然,您可以编写自己的 VAST 解析库,而不是 videojs,而是使用媒体元素(以太视频或音频)来播放实际广告。VAST 不需要 Javascript 和 HTML5 中尚不存在的任何内容。

于 2015-12-23T20:35:48.270 回答