Appearance
视频后贴广告
1.初始化广告
代码示例:
点击查看源码
vue
...
<es-player-manager
:ad-test-server="true"
...
2.自定义广告provider
- 参数
providerParams
:为Object
类型,属性自定义,无限制。
点击查看源码
js
{
xx: 1,
xxx: 2,
}
- 返回:广告信息。
点击查看源码
js
{
adId: 'String类型。广告的id',
adType: Number类型。广告的类型
mediaId: String类型。 '视频的id',
adCount: Number类型。后贴广告的数量,
}
示例代码: ADProvider.js
点击查看源码
vue
import {ES_AD_TYPE_BEHIND} from "@extscreen/es-ad-player";
export function adProvider(provideParams) {
return new Promise(function (resolve, reject) {
//...
//其他操作...
let result = {
adId: 'extscreen-openscreen',
adType: ES_AD_TYPE_BEHIND,
mediaId: '1111',
adCount: 1,
}
resolve(result);
});
}
3.分集中注册provider
点击查看源码
vue
import {adProvider} from "@/views/ad/ADProvider";
let series = {
id: 0,
urls: {
urlIndex: 0,
urlList: [{
url: 'http://qcloudcdn-moss.cp47.ott.cibntv.net/project/tvq/qsj_video/2021/12/07/3800609_9c0bae6b6d5df502ffa28f9396a2316e.mp4',
}],
},
playerType: 1,
//--------------------后贴广告------------------
behindAD: {
support: true,
urlsProvider: {
provider: adProvider,
providerParams: {
adVideoType: 'xxxx',
albumId: 'xxxxx',
mediaId: 'xxxxx',
},
},
},
}
let playInfo = {
seriesIndex: 0,
seriesList: [series]
}
this.$refs.es_player_manager.playVideo(playInfo);