javascript - 如何在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>
解决方案
首先,您需要满足以下两个要求:
- 开发人员或企业许可证(包括广告的许可证)
- 您的 Bebi 展示位置 ID
其次,此代码应将您的 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>
推荐阅读
- c# - 我是否应该尽可能使用“in”参数修饰符?
- javascript - 使用 webView 的 Javascript 解析返回不同的结果
- python - 当我输入 python bot.py 命令不会执行
- java - 如何正确使用 hasNextInt 方法作为 if 语句逻辑语句
- javascript - addEventListener() 中的调用函数
- c# - C# 中是否有 XOR 样式或多类型锁?
- javascript - 我需要帮助理解 React 应用程序中的 TypeError 吗?
- amazon-web-services - 使用索引扫描 dynamodb 上的 aws lambda 函数
- mysql - 为什么以下查询不起作用(您不能在 FROM 子句中指定目标表 'p1' 进行更新)?
- php - 使用下拉菜单将主 ID 传递给使用 MYSQLi 的 PHP 表单不起作用