re enable preload ads

This commit is contained in:
Anthony 2021-10-05 20:04:41 +03:00
parent a04c69f787
commit 65994c4ebf
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
3 changed files with 38 additions and 38 deletions

View file

@ -327,19 +327,17 @@ function App(props: Props) {
// Load IMA3 SDK for aniview: DISABLED FOR NOW // Load IMA3 SDK for aniview: DISABLED FOR NOW
// @if TARGET='web' // @if TARGET='web'
// useEffect(() => { useEffect(() => {
// if (ENABLE_PREROLL_ADS) { const script = document.createElement('script');
// const script = document.createElement('script'); script.src = `https://imasdk.googleapis.com/js/sdkloader/ima3.js`;
// script.src = `https://imasdk.googleapis.com/js/sdkloader/ima3.js`; script.async = true;
// script.async = true; // $FlowFixMe
// // $FlowFixMe document.body.appendChild(script);
// document.body.appendChild(script); return () => {
// return () => { // $FlowFixMe
// // $FlowFixMe document.body.removeChild(script);
// document.body.removeChild(script); };
// }; });
// }
// });
// @endif // @endif
// @if TARGET='app' // @if TARGET='app'

View file

@ -26,27 +26,27 @@ const VERSION = '0.0.1';
* */ * */
// TEST PRE-ROLL WITH THIS TAG: // TEST PRE-ROLL WITH THIS TAG:
// https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonly&cmsid=496&vid=short_onecue&correlator= const macroUrl = 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonly&cmsid=496&vid=short_onecue&correlator=';
// 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` + // `&skip=true` +
`&skiptimer=5` + // `&skiptimer=5` +
`&logo=true` + // `&logo=true` +
`&usevslot=true` + // `&usevslot=true` +
`&vastretry=5` + // `&vastretry=5` +
`&hidecontrols=false`; // `&hidecontrols=false`;
const defaults = { const defaults = {
adTagUrl: macroUrl, adTagUrl: macroUrl,
@ -69,16 +69,16 @@ class AniviewPlugin extends Component {
this.player = player; this.player = player;
// request ads whenever there's new video content // request ads whenever there's new video content
/* player.on('contentchanged', () => { player.on('contentchanged', () => {
// in a real plugin, you might fetch your ad inventory here // in a real plugin, you might fetch your ad inventory here
player.trigger('adsready'); player.trigger('adsready');
}); */ });
// Plugin event listeners // Plugin event listeners
// player.on('readyforpreroll', (event) => this.onReadyForPreroll(event)); player.on('readyforpreroll', (event) => this.onReadyForPreroll(event));
} }
/* onReadyForPreroll(event) { onReadyForPreroll(event) {
// send event when ad is playing to remove loading spinner // send event when ad is playing to remove loading spinner
this.player.one('adplaying', () => { this.player.one('adplaying', () => {
this.player.trigger('ads-ad-started'); this.player.trigger('ads-ad-started');
@ -88,7 +88,7 @@ class AniviewPlugin extends Component {
this.player.one('adended', () => { this.player.one('adended', () => {
this.player.ads.endLinearAdMode(); this.player.ads.endLinearAdMode();
}); });
} */ }
log(...args) { log(...args) {
if (this.options_.debug) { if (this.options_.debug) {

View file

@ -16,7 +16,7 @@ import qualityLevels from 'videojs-contrib-quality-levels';
import isUserTyping from 'util/detect-typing'; import isUserTyping from 'util/detect-typing';
// @if TARGET='web' // @if TARGET='web'
// Disabled for now. // Disabled for now.
// import './plugins/videojs-aniview/plugin'; import './plugins/videojs-aniview/plugin';
// @endif // @endif
const isDev = process.env.NODE_ENV !== 'production'; const isDev = process.env.NODE_ENV !== 'production';
@ -580,6 +580,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// I think this is a callback function // I think this is a callback function
const videoNode = containerRef.current && containerRef.current.querySelector('video, audio'); const videoNode = containerRef.current && containerRef.current.querySelector('video, audio');
onPlayerReady(player, videoNode); onPlayerReady(player, videoNode);
vjs.aniview();
}); });
// pre-roll ads // pre-roll ads