switch macro (#102)

* switch macro

* allow skip and other options
This commit is contained in:
mayeaux 2021-10-20 18:14:33 +03:00 committed by GitHub
parent 6ff9a51058
commit c782f73f30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -558,18 +558,49 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// 612fb75a42715a07645a614c // 612fb75a42715a07645a614c
// Modified to work with IMA // Modified to work with IMA
const macroUrl = // const macroUrl =
`https://vast.aniview.com/api/adserver61/vast/` + // `https://vast.aniview.com/api/adserver61/vast/` +
`?AV_PUBLISHERID=60afcbc58cfdb065440d2426` + // `?AV_PUBLISHERID=60afcbc58cfdb065440d2426` +
`&AV_CHANNELID=60b354389c7adb506d0bd9a4` + // `&AV_CHANNELID=60b354389c7adb506d0bd9a4` +
`&AV_URL=[URL]` + // `&AV_URL=[URL]` +
`&cb=[CACHEBUSTING]` + // `&cb=[CACHEBUSTING]` +
`&AV_WIDTH=[WIDTH]` + // `&AV_WIDTH=[WIDTH]` +
`&AV_HEIGHT=[HEIGHT]` + // `&AV_HEIGHT=[HEIGHT]` +
// `&AV_SCHAIN=[SCHAIN_MACRO]` + // // `&AV_SCHAIN=[SCHAIN_MACRO]` +
// `&AV_CCPA=[CCPA_MACRO]` + // // `&AV_CCPA=[CCPA_MACRO]` +
// `&AV_GDPR=[GDPR_MACRO]` + // // `&AV_GDPR=[GDPR_MACRO]` +
// `&AV_CONSENT=[CONSENT_MACRO]` + // // `&AV_CONSENT=[CONSENT_MACRO]` +
// `&skip=true` +
// `&skiptimer=5` +
// `&logo=true` +
// `&usevslot=true` +
// `&vastretry=2` +
// `&hidecontrols=false`;
const timestamp = new Date().toISOString();
const videoElement = document.getElementsByClassName('vjs-tech')[0];
const height = videoElement.offsetHeight;
const width = videoElement.offsetWidth;
// live channel
// 60b354389c7adb506d0bd9a4
// ford ad
// 612fb75a42715a07645a614c
const macroUrl1 = 'https://gov.aniview.com/api/adserver/vast3/' +
'?AV_PUBLISHERID=60afcbc58cfdb065440d2426' +
'&AV_CHANNELID=60b354389c7adb506d0bd9a4' +
`&AV_URL=${encodeURIComponent(window.location.href)}` +
`&cb=${encodeURIComponent(timestamp)}` +
`&AV_WIDTH=${width}` +
`&AV_HEIGHT=${height}` +
// '&AV_SCHAIN=[SCHAIN_MACRO]' +
// '&AV_CCPA=[CCPA_MACRO]' +
// '&AV_GDPR=[GDPR_MACRO]' +
// '&AV_CONSENT=[CONSENT_MACRO]' +
`&skip=true` + `&skip=true` +
`&skiptimer=5` + `&skiptimer=5` +
`&logo=true` + `&logo=true` +
@ -590,10 +621,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
if (shouldShowAnAd && browserIsChrome && !IS_MOBILE) { if (shouldShowAnAd && browserIsChrome && !IS_MOBILE) {
// fire up ima integration via module // fire up ima integration via module
player.ima({ player.ima({
adTagUrl: macroUrl, adTagUrl: macroUrl1,
vpaidMode: 2, // 2 = INSECURE vpaidMode: 2,
// // $FlowFixMe
// vpaidMode: google.ima.ImaSdkSettings.VpaidMode.INSECURE,
}); });
} }