diff --git a/adscript/src/adscript/AdScript.d.ts b/adscript/src/adscript/AdScript.d.ts index 59b42148..14fb9817 100644 --- a/adscript/src/adscript/AdScript.d.ts +++ b/adscript/src/adscript/AdScript.d.ts @@ -1,76 +1,75 @@ -export type JHMTApiProtocol = "https:" | "http:" | "file:" +export type JHMTApiProtocol = 'https:' | 'http:' | 'file:'; interface I12n { - i1: string; - i2: string; - i3: string; - i4: string; - i5: string; + i1: string; + i2: string; + i3: string; + i4: string; + i5: string; } -export type MainVideoContentType = "content" -export type EmbeddedContentType = "preroll" | "midroll" | "postroll" -export type StaticContentType = "static" +export type MainVideoContentType = 'content'; +export type EmbeddedContentType = 'preroll' | 'midroll' | 'postroll'; +export type StaticContentType = 'static'; export interface MainVideoContentMetadata { - assetid: string; - type: MainVideoContentType; - program: string; - title: string; - length: string; - crossId: string; - livestream: string; - channelId: string; - attributes: string; + assetid: string; + type: MainVideoContentType; + program: string; + title: string; + length: string; + crossId: string; + livestream: string; + channelId: string; + attributes: string; } interface EmbeddedContentMetadata { - assetid: string; - type: EmbeddedContentType; - length: string; - title: string; - asmea: string; - attributes: string; + assetid: string; + type: EmbeddedContentType; + length: string; + title: string; + asmea: string; + attributes: string; } - interface StaticContentMetadata { - assetid: string; - type: MainVideoContentType; - sec1: string; - sec2: string; - sec3: string; - sec4: string; - ref: string; + assetid: string; + type: MainVideoContentType; + sec1: string; + sec2: string; + sec3: string; + sec4: string; + ref: string; } export interface PlayerState { - muted: number; - volume: number; - triggeredByUser: number; - normalSpeed: number; - fullscreen: number; - visibility: number; - width: number; - height: number; + muted: number; + volume: number; + triggeredByUser: number; + normalSpeed: number; + fullscreen: number; + visibility: number; + width: number; + height: number; } interface JHMTArray extends Array { - i12n: I12n; - contentMetadata: ContentMetadata; - playerState: PlayerState; - push: (item: any) => number; // Type of the push function + i12n: I12n; + contentMetadata: ContentMetadata; + playerState: PlayerState; + push: (item: any) => number; // Type of the push function } declare global { - interface Window { - JHMT: JHMTArray; - JHMTApi: typeof JHMTApi; - JHMTApiProtocol: JHMTApiProtocol - } + interface Window { + JHMT: JHMTArray; + JHMTApi: typeof JHMTApi; + JHMTApiProtocol: JHMTApiProtocol; + } } export interface JHMTApi { setI12n(i12n: I12n); setContentMetadata(contentMetadata: ContentMetadata); setPlayerState(playerState: PlayerState); -} \ No newline at end of file +} diff --git a/adscript/src/index.ts b/adscript/src/index.ts index c904706c..da9e700c 100644 --- a/adscript/src/index.ts +++ b/adscript/src/index.ts @@ -1,2 +1,2 @@ export { AdScriptConnector } from './integration/AdScriptConnector'; -export * from './integration/AdScriptConfiguration' +export * from './integration/AdScriptConfiguration'; diff --git a/adscript/src/integration/AdScriptConfiguration.ts b/adscript/src/integration/AdScriptConfiguration.ts index 752b0b94..8121056a 100644 --- a/adscript/src/integration/AdScriptConfiguration.ts +++ b/adscript/src/integration/AdScriptConfiguration.ts @@ -1,9 +1,9 @@ -import { Ad } from "theoplayer"; -import { EmbeddedContentMetadata } from "../adscript/AdScript"; +import { Ad } from 'theoplayer'; +import { EmbeddedContentMetadata } from '../adscript/AdScript'; export interface AdScriptConfiguration { implementationId: string; - i12n: {[key: string]: string} + i12n: { [key: string]: string }; debug?: boolean; - adProcessor?: (ad: Ad) => EmbeddedContentMetadata -} \ No newline at end of file + adProcessor?: (ad: Ad) => EmbeddedContentMetadata; +} diff --git a/adscript/src/integration/AdScriptConnector.ts b/adscript/src/integration/AdScriptConnector.ts index 9b234860..11c3619b 100644 --- a/adscript/src/integration/AdScriptConnector.ts +++ b/adscript/src/integration/AdScriptConnector.ts @@ -5,7 +5,6 @@ import { MainVideoContentMetadata } from '../adscript/AdScript'; import { Logger } from '../utils/Logger'; export class AdScriptConnector { - private adscriptIntegration: AdScriptTHEOIntegration | undefined; /** @@ -15,37 +14,37 @@ export class AdScriptConnector { * @param metadata the MainVideoContentMetadata * @returns */ - constructor(player: ChromelessPlayer, configuration: AdScriptConfiguration, metadata: MainVideoContentMetadata) { - const interval = window.setInterval(() => { - if (typeof window.JHMTApi === 'object') { - window.clearInterval(interval); - const { i12n } = configuration + constructor(player: ChromelessPlayer, configuration: AdScriptConfiguration, metadata: MainVideoContentMetadata) { + const interval = window.setInterval(() => { + if (typeof window.JHMTApi === 'object') { + window.clearInterval(interval); + const { i12n } = configuration; for (const id in i12n) { - window.JHMTApi.setI12n(id, i12n[id]) + window.JHMTApi.setI12n(id, i12n[id]); Logger.logsetI12n(id, i12n[id]); } - this.adscriptIntegration = new AdScriptTHEOIntegration(player, configuration, metadata) - - } - }, 20) + this.adscriptIntegration = new AdScriptTHEOIntegration(player, configuration, metadata); + } + }, 20); window.setTimeout(() => { if (!window.JHMTApi) { - window.clearInterval(interval) - console.error('JHMT API not found, make sure you included the script to initialize AdScript Measurement') + window.clearInterval(interval); + console.error( + 'JHMT API not found, make sure you included the script to initialize AdScript Measurement' + ); return; } - }, 5000) + }, 5000); } updateMetadata(metadata: any): void { - this.adscriptIntegration?.updateMetadata(metadata) + this.adscriptIntegration?.updateMetadata(metadata); } - /** - * Destroy + * Destroy */ destroy(): void { - this.adscriptIntegration?.destroy() + this.adscriptIntegration?.destroy(); } -} \ No newline at end of file +} diff --git a/adscript/src/integration/AdScriptTHEOIntegration.ts b/adscript/src/integration/AdScriptTHEOIntegration.ts index 2d5fdf0b..018d1932 100644 --- a/adscript/src/integration/AdScriptTHEOIntegration.ts +++ b/adscript/src/integration/AdScriptTHEOIntegration.ts @@ -1,4 +1,4 @@ -import { +import type { Ad, AdBreakEvent, AdEvent, @@ -11,16 +11,21 @@ import { RateChangeEvent, SourceChangeEvent, TimeUpdateEvent, - VolumeChangeEvent, + VolumeChangeEvent } from 'theoplayer'; import { AdScriptConfiguration } from './AdScriptConfiguration'; -import { EmbeddedContentMetadata, EmbeddedContentType, MainVideoContentMetadata, PlayerState } from './../adscript/AdScript' +import { + EmbeddedContentMetadata, + EmbeddedContentType, + MainVideoContentMetadata, + PlayerState +} from './../adscript/AdScript'; import { Logger } from '../utils/Logger'; interface LogPoint { offset: number; name: string; - reported: boolean + reported: boolean; } export class AdScriptTHEOIntegration { @@ -32,7 +37,7 @@ export class AdScriptTHEOIntegration { private mainContentLogPoints: LogPoint[] = []; private mainContentDuration: number | undefined; private currentAdMetadata: EmbeddedContentMetadata | undefined; - private currentAdLogPoints: LogPoint[] = [] + private currentAdLogPoints: LogPoint[] = []; private latestReportedEvent: string | undefined; @@ -41,19 +46,19 @@ export class AdScriptTHEOIntegration { constructor(player: ChromelessPlayer, configuration: AdScriptConfiguration, metadata: MainVideoContentMetadata) { this.player = player; - this.debug = configuration.debug ?? false; + this.debug = configuration.debug ?? false; this.adProcessor = configuration?.adProcessor; this.mainContentMetadata = metadata; - Logger.logSetContentMetadata(this.mainContentMetadata) - this.JHMTApi.setContentMetadata(this.mainContentMetadata) + Logger.logSetContentMetadata(this.mainContentMetadata); + this.JHMTApi.setContentMetadata(this.mainContentMetadata); this.reportPlayerState(); this.addListeners(); } public updateMetadata(metadata: MainVideoContentMetadata) { - this.mainContentMetadata = metadata - Logger.logSetContentMetadata(this.mainContentMetadata) - this.JHMTApi.setContentMetadata(this.mainContentMetadata) + this.mainContentMetadata = metadata; + Logger.logSetContentMetadata(this.mainContentMetadata); + this.JHMTApi.setContentMetadata(this.mainContentMetadata); } public destroy() { @@ -61,29 +66,28 @@ export class AdScriptTHEOIntegration { } private addListeners(): void { - this.player.addEventListener('playing', this.onFirstMainContentPlaying) + this.player.addEventListener('playing', this.onFirstMainContentPlaying); this.player.addEventListener('durationchange', this.onDurationChange); this.player.addEventListener('sourcechange', this.onSourceChange); - this.player.addEventListener('timeupdate', this.onTimeUpdate); + this.player.addEventListener('timeupdate', this.onTimeUpdate); this.player.addEventListener('play', this.onPlay); // TODO this.player.addEventListener('ended', this.onEnded); // TODO this.player.addEventListener('volumechange', this.onVolumeChange); this.player.addEventListener('ratechange', this.onRateChange); this.player.addEventListener('presentationmodechange', this.onPresentationModeChange); - window.addEventListener("resize", this.reportPlayerState); - window.addEventListener("blur", this.reportPlayerState); - window.addEventListener("focus", this.reportPlayerState); - document.addEventListener("scroll", this.reportPlayerState); - document.addEventListener("visibilitychange", this.reportPlayerState); + window.addEventListener('resize', this.reportPlayerState); + window.addEventListener('blur', this.reportPlayerState); + window.addEventListener('focus', this.reportPlayerState); + document.addEventListener('scroll', this.reportPlayerState); + document.addEventListener('visibilitychange', this.reportPlayerState); if (this.player.ads) { this.player.ads.addEventListener('adbreakend', this.onAdBreakEnd); //TODO this.player.ads.addEventListener('adbegin', this.onAdBegin); //TODO - this.player.ads.addEventListener("adfirstquartile", this.onAdFirstQuartile); - this.player.ads.addEventListener("admidpoint", this.onAdMidpoint); - this.player.ads.addEventListener("adthirdquartile", this.onAdTirdQuartile); - this.player.ads.addEventListener("adend", this.onAdEnd); + this.player.ads.addEventListener('adfirstquartile', this.onAdFirstQuartile); + this.player.ads.addEventListener('admidpoint', this.onAdMidpoint); + this.player.ads.addEventListener('adthirdquartile', this.onAdTirdQuartile); + this.player.ads.addEventListener('adend', this.onAdEnd); } - } private removeListeners(): void { @@ -95,16 +99,16 @@ export class AdScriptTHEOIntegration { this.player.removeEventListener('volumechange', this.onVolumeChange); this.player.removeEventListener('ratechange', this.onRateChange); this.player.removeEventListener('presentationmodechange', this.onPresentationModeChange); - window.removeEventListener("resize", this.reportPlayerState); - window.removeEventListener("blur", this.reportPlayerState); - window.removeEventListener("focus", this.reportPlayerState); - document.removeEventListener("scroll", this.reportPlayerState); - document.removeEventListener("visibilitychange", this.reportPlayerState); + window.removeEventListener('resize', this.reportPlayerState); + window.removeEventListener('blur', this.reportPlayerState); + window.removeEventListener('focus', this.reportPlayerState); + document.removeEventListener('scroll', this.reportPlayerState); + document.removeEventListener('visibilitychange', this.reportPlayerState); if (this.player.ads) { this.player.ads.removeEventListener('adbreakend', this.onAdBreakEnd); //TODO this.player.ads.removeEventListener('adbegin', this.onAdBegin); //TODO } - this.player.removeEventListener('playing', this.onFirstMainContentPlaying) + this.player.removeEventListener('playing', this.onFirstMainContentPlaying); } // EVENT HANDLERS @@ -113,125 +117,125 @@ export class AdScriptTHEOIntegration { const { duration } = event; const firstSecondOfMainContent = this.player.ads?.dai?.streamTimeForContentTime(1); const useDAITimeline = firstSecondOfMainContent && firstSecondOfMainContent !== 1; - this.mainContentDuration = duration + this.mainContentDuration = duration; if (duration === Infinity) { - this.mainContentLogPoints = [{reported: false, offset: this.player.currentTime + 1, name: "progress1"}] + this.mainContentLogPoints = [{ reported: false, offset: this.player.currentTime + 1, name: 'progress1' }]; } else { this.mainContentLogPoints = [ - {reported: false, offset: duration * 0.75, name: "thirdQuartile"}, - {reported: false, offset: duration * 0.5, name: "midpoint"}, - {reported: false, offset: duration * 0.25, name: "firstQuartile"}, - {reported: false, offset: useDAITimeline ? firstSecondOfMainContent : 1, name: "progress1"} - ] + { reported: false, offset: duration * 0.75, name: 'thirdQuartile' }, + { reported: false, offset: duration * 0.5, name: 'midpoint' }, + { reported: false, offset: duration * 0.25, name: 'firstQuartile' }, + { reported: false, offset: useDAITimeline ? firstSecondOfMainContent : 1, name: 'progress1' } + ]; } - } + }; private onSourceChange = (event: SourceChangeEvent) => { Logger.logEvent(event); - this.player.removeEventListener('playing', this.onFirstMainContentPlaying) - this.player.addEventListener('playing', this.onFirstMainContentPlaying) - this.mainContentLogPoints = [] - this.currentAdLogPoints = [] - this.currentAdMetadata = undefined - }; + this.player.removeEventListener('playing', this.onFirstMainContentPlaying); + this.player.addEventListener('playing', this.onFirstMainContentPlaying); + this.mainContentLogPoints = []; + this.currentAdLogPoints = []; + this.currentAdMetadata = undefined; + }; private onTimeUpdate = (event: TimeUpdateEvent) => { const { currentTime } = event; if (this.currentAdMetadata) { - this.maybeReportLogPoint(currentTime, this.currentAdMetadata, this.currentAdLogPoints) + this.maybeReportLogPoint(currentTime, this.currentAdMetadata, this.currentAdLogPoints); } else { - this.maybeReportLogPoint(currentTime, this.mainContentMetadata, this.mainContentLogPoints) + this.maybeReportLogPoint(currentTime, this.mainContentMetadata, this.mainContentLogPoints); } - } + }; private onFirstMainContentPlaying = () => { - const isBeforePreroll = this.player.ads?.scheduledAdBreaks.find(adBreak => adBreak.timeOffset === 0); + const isBeforePreroll = this.player.ads?.scheduledAdBreaks.find((adBreak) => adBreak.timeOffset === 0); if (this.player.ads?.playing || isBeforePreroll) return; - Logger.logAdScriptEvent("start",this.mainContentMetadata); - this.JHMT.push(["start", this.mainContentMetadata]); - this.player.removeEventListener("playing", this.onFirstMainContentPlaying); - } + Logger.logAdScriptEvent('start', this.mainContentMetadata); + this.JHMT.push(['start', this.mainContentMetadata]); + this.player.removeEventListener('playing', this.onFirstMainContentPlaying); + }; private onPlay = (event: PlayEvent) => { Logger.logEvent(event); this.reportPlayerState; - } + }; private onEnded = (event: EndedEvent) => { Logger.logEvent(event); - Logger.logAdScriptEvent("complete",this.mainContentMetadata); - this.JHMT.push(["complete", this.mainContentMetadata]); - } + Logger.logAdScriptEvent('complete', this.mainContentMetadata); + this.JHMT.push(['complete', this.mainContentMetadata]); + }; private onVolumeChange = (event: VolumeChangeEvent) => { Logger.logEvent(event); this.reportPlayerState(); - } + }; private onRateChange = (event: RateChangeEvent) => { Logger.logEvent(event); this.reportPlayerState(); - } + }; private onPresentationModeChange = (event: Event) => { Logger.logEvent(event); this.reportPlayerState(); - } + }; private onAdBreakEnd = (event: AdBreakEvent<'adbreakend'>) => { Logger.logEvent(event); const { adBreak } = event; - const { timeOffset, integration } = adBreak + const { timeOffset, integration } = adBreak; this.currentAdLogPoints = []; this.currentAdMetadata = undefined; - if (integration === "google-dai" && timeOffset === 0) { - this.onFirstMainContentPlaying() + if (integration === 'google-dai' && timeOffset === 0) { + this.onFirstMainContentPlaying(); } - } + }; private onAdFirstQuartile = (event: AdEvent<'adfirstquartile'>) => { Logger.logEvent(event); - Logger.logAdScriptEvent("firstquartile",this.currentAdMetadata); - this.JHMT.push(["firstquartile", this.currentAdMetadata]) - } + Logger.logAdScriptEvent('firstquartile', this.currentAdMetadata); + this.JHMT.push(['firstquartile', this.currentAdMetadata]); + }; private onAdMidpoint = (event: AdEvent<'admidpoint'>) => { Logger.logEvent(event); - Logger.logAdScriptEvent("midpoint",this.currentAdMetadata); - this.JHMT.push(["midpoint", this.currentAdMetadata]) - } + Logger.logAdScriptEvent('midpoint', this.currentAdMetadata); + this.JHMT.push(['midpoint', this.currentAdMetadata]); + }; private onAdTirdQuartile = (event: AdEvent<'adthirdquartile'>) => { Logger.logEvent(event); - Logger.logAdScriptEvent("thirdquartile",this.currentAdMetadata); - this.JHMT.push(["thirdquartile", this.currentAdMetadata]) - } + Logger.logAdScriptEvent('thirdquartile', this.currentAdMetadata); + this.JHMT.push(['thirdquartile', this.currentAdMetadata]); + }; private onAdEnd = (event: AdEvent<'adend'>) => { Logger.logEvent(event); - Logger.logAdScriptEvent("complete",this.currentAdMetadata); - this.JHMT.push(["complete", this.currentAdMetadata]) - } + Logger.logAdScriptEvent('complete', this.currentAdMetadata); + this.JHMT.push(['complete', this.currentAdMetadata]); + }; private onAdBegin = (event: AdEvent<'adbegin'>) => { Logger.logEvent(event); - if (event.ad.type !== "linear") return - const adMetadataObject = this.buildAdMetadataObject(event) - this.currentAdMetadata = adMetadataObject - this.currentAdLogPoints = this.buildAdLogPoints(event.ad) - Logger.logAdScriptEvent("start",this.currentAdMetadata); - this.JHMT.push(["start",this.currentAdMetadata]) - } + if (event.ad.type !== 'linear') return; + const adMetadataObject = this.buildAdMetadataObject(event); + this.currentAdMetadata = adMetadataObject; + this.currentAdLogPoints = this.buildAdLogPoints(event.ad); + Logger.logAdScriptEvent('start', this.currentAdMetadata); + this.JHMT.push(['start', this.currentAdMetadata]); + }; private buildAdLogPoints = (ad: Ad) => { - const { duration } = ad - if (ad.adBreak.integration === "theo" && duration) { + const { duration } = ad; + if (ad.adBreak.integration === 'theo' && duration) { return [ - {reported: false, offset: duration * 0.75, name: "thirdQuartile"}, - {reported: false, offset: duration * 0.5, name: "midpoint"}, - {reported: false, offset: duration * 0.25, name: "firstQuartile"}, - {reported: false, offset: 1, name: "progress1"} - ] + { reported: false, offset: duration * 0.75, name: 'thirdQuartile' }, + { reported: false, offset: duration * 0.5, name: 'midpoint' }, + { reported: false, offset: duration * 0.25, name: 'firstQuartile' }, + { reported: false, offset: 1, name: 'progress1' } + ]; } - return [{reported: false, offset: 1, name: "progress1"}] - } + return [{ reported: false, offset: 1, name: 'progress1' }]; + }; private buildAdMetadataObject = (event: AdEvent<'adbegin'>): EmbeddedContentMetadata => { const { ad } = event; @@ -240,50 +244,54 @@ export class AdScriptTHEOIntegration { return { ...this.adProcessor(ad), type: this.getAdType(adBreak.timeOffset, this.player.duration, adBreak.integration), - length: ad.duration?.toString() ?? "" - } + length: ad.duration?.toString() ?? '' + }; } return { - assetid: ad.id ?? "", + assetid: ad.id ?? '', type: this.getAdType(adBreak.timeOffset, this.player.duration, adBreak.integration), - length: ad.duration?.toString() ?? "", - title: ad.integration?.includes("google") ? (ad as GoogleImaAd).title ?? "" : "", - asmea: "", - attributes: "" - } - } + length: ad.duration?.toString() ?? '', + title: ad.integration?.includes('google') ? (ad as GoogleImaAd).title ?? '' : '', + asmea: '', + attributes: '' + }; + }; private getAdType = (offset: number, duration: number, integration: string | undefined): EmbeddedContentType => { - if (offset === 0) return "preroll"; - if (offset === -1) return "postroll"; - if (duration - offset < 1 && integration === "google-dai") return "postroll" - if (this.mainContentDuration && this.mainContentDuration - offset < 1 ) return "postroll" - return "midroll" - } - + if (offset === 0) return 'preroll'; + if (offset === -1) return 'postroll'; + if (duration - offset < 1 && integration === 'google-dai') return 'postroll'; + if (this.mainContentDuration && this.mainContentDuration - offset < 1) return 'postroll'; + return 'midroll'; + }; + private reportPlayerState = () => { const playerState: PlayerState = { muted: this.player.muted ? 1 : 0, volume: this.player.volume * 100, triggeredByUser: this.player.autoplay ? 1 : 0, normalSpeed: this.player.playbackRate === 1 ? 1 : 0, - fullscreen: this.player.presentation.currentMode === "fullscreen" ? 1 : 0, + fullscreen: this.player.presentation.currentMode === 'fullscreen' ? 1 : 0, visibility: this.player.visibility.ratio * 100, width: this.player.element.clientWidth, height: this.player.element.clientHeight - } - Logger.logPlayerState(playerState) - this.JHMTApi.setPlayerState(playerState) - } + }; + Logger.logPlayerState(playerState); + this.JHMTApi.setPlayerState(playerState); + }; - private maybeReportLogPoint = (currentTime: number, metadata: MainVideoContentMetadata | EmbeddedContentMetadata, logPoints: LogPoint[]) => { - logPoints.forEach(logPoint => { - const { reported, offset, name } = logPoint + private maybeReportLogPoint = ( + currentTime: number, + metadata: MainVideoContentMetadata | EmbeddedContentMetadata, + logPoints: LogPoint[] + ) => { + logPoints.forEach((logPoint) => { + const { reported, offset, name } = logPoint; if (!reported && currentTime >= offset && currentTime < offset + 1) { - logPoint.reported = true - Logger.logAdScriptEvent(name,metadata); - this.JHMT.push([name,metadata]) + logPoint.reported = true; + Logger.logAdScriptEvent(name, metadata); + this.JHMT.push([name, metadata]); } - }) - } + }); + }; } diff --git a/adscript/src/utils/Logger.ts b/adscript/src/utils/Logger.ts index 3a53dfd4..68736568 100644 --- a/adscript/src/utils/Logger.ts +++ b/adscript/src/utils/Logger.ts @@ -1,31 +1,33 @@ -import { Event } from "theoplayer"; -import { EmbeddedContentMetadata, MainVideoContentMetadata, PlayerState } from "../adscript/AdScript"; +import { Event } from 'theoplayer'; +import { EmbeddedContentMetadata, MainVideoContentMetadata, PlayerState } from '../adscript/AdScript'; const LOG_THEOPLAYER_EVENTS = true; -const LOG_SETPLAYERSTATE = true -const LOG_SETMETADATA = true -const LOG_ADSCRIPT_EVENTS = true +const LOG_SETPLAYERSTATE = true; +const LOG_SETMETADATA = true; +const LOG_ADSCRIPT_EVENTS = true; const LOG_SETI12N = true; export class Logger { static logEvent = (event: Event) => { - if (LOG_THEOPLAYER_EVENTS) - console.log(`[ADSCRIPT - THEOplayer EVENTS] ${event.type} event`); - } + if (LOG_THEOPLAYER_EVENTS) console.log(`[ADSCRIPT - THEOplayer EVENTS] ${event.type} event`); + }; static logPlayerState = (playerState: PlayerState) => { - if (LOG_SETPLAYERSTATE) console.log(`[ADSCRIPT - setPlayerState]`,playerState); - } + if (LOG_SETPLAYERSTATE) console.log(`[ADSCRIPT - setPlayerState]`, playerState); + }; static logSetContentMetadata = (metadata: MainVideoContentMetadata) => { - if (LOG_SETMETADATA) console.log(`[ADSCRIPT - setContentMetadata]`,metadata); - } + if (LOG_SETMETADATA) console.log(`[ADSCRIPT - setContentMetadata]`, metadata); + }; - static logAdScriptEvent = (name: string, metadata: MainVideoContentMetadata | EmbeddedContentMetadata | undefined) => { - if (LOG_ADSCRIPT_EVENTS) console.log(`[ADSCRIPT - EVENT] ${name}`,metadata) - } + static logAdScriptEvent = ( + name: string, + metadata: MainVideoContentMetadata | EmbeddedContentMetadata | undefined + ) => { + if (LOG_ADSCRIPT_EVENTS) console.log(`[ADSCRIPT - EVENT] ${name}`, metadata); + }; static logsetI12n = (id: string, value: string) => { - if (LOG_SETI12N) console.log(`[ADSCRIPT - SET I12N] ${id}: ${value}`) - } -} \ No newline at end of file + if (LOG_SETI12N) console.log(`[ADSCRIPT - SET I12N] ${id}: ${value}`); + }; +}