首页 > 解决方案 > 如何在jw播放器中添加大量广告

问题描述

我正在尝试在 jwplayer 上添加来自广告网站的大量广告这是我从广告网站得到的

Bebi Video Ads :: Vast Instructions

To get vast url you should first include Bebi script on top of your page:

<script type="text/javascript" data-cfasync="false" src="//st.bebi.com/bebi_v3.js"></script>

then to get a vast url you should call:

BB.getVASTUrl(209831);

wherever you need it.


More information and examples can be found at:

https://bebimedia.freshdesk.com/solution/articles/14000075614-how-to-use-bebi-video-ads

我试过了,不知道下一步

<script type="text/javascript" data-cfasync="false" src="//st.bebi.com/bebi_v3.js"></script>

<script src="https://cdn.jwplayer.com/libraries/SNAMyqnD.js"></script>

<div id="player"></div>

<script>
var videoPlayer = jwplayer("player");
videoPlayer.setup({
sources: [{file: "https://www.w3schools.com/tags/mov_bbb.mp4"}],
width:"100%",
height:"100%",
});
</script>

标签: javascriptvideojwplayervast

解决方案


首先,您需要满足以下两个要求:

其次,此代码应将您的 Bebi 广告加载到 JW Player 的前贴片广告中。如果您有其他广告插播时间(插播广告、后贴片广告),请查看 JW Player 的广告文档。

<html>

<head>
    <script type="text/javascript" data-cfasync="false" src="https://st.bebi.com/bebi_v3.js"></script>

    <script src="https://cdn.jwplayer.com/libraries/SNAMyqnD.js"></script>
</head>

<body>
    <div id="player"></div>

    <script>
        var videoPlayer = jwplayer("player");
        var vasturl = BB.getVASTUrl(your_placement_id); 

        videoPlayer.setup({
            "playlist": [{
                "file": "https://www.w3schools.com/tags/mov_bbb.mp4"
            }],
            "height": 360,
            "width": 640,
            "advertising": {
                "client": "googima",
                "schedule": [{
                    "offset": "pre",
                    "tag": vasturl                  
                }]
            }
        });
    </script>
</body>

</html>

推荐阅读