Advertising events in API

  抱歉,这篇文章有英文版

You can catch ad events via JS API if you enable the Track VAST events option in the API settings

Events come with the vast_ prefix

function PlayerjsEvents(event,id,info){
   if(event=="vast_Impression"){
      console.log(event, info);
   }
   if(event=="vast_Error"){
      console.log(event, info); //there will be an error code in info
   }
}

You can catch the end of an ad block using the vast_finish event and request information about current advertising with vastinfo

player.api("vastinfo");

The player will return an object with information in response.


21.0.1
2025 © PlayerJS

登录

登录

免费注册

注册
注册即表示您同意服务条款
登录(如果您有帐户)

恢复密码

恢复
忘记电子邮件?联系我们