@hopeplayer/core 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -14
- package/dist/HopePlayerElement.d.ts +3 -0
- package/dist/HopePlayerElement.d.ts.map +1 -1
- package/dist/chunks/{index-CWLyz1fp.js → adTriggers-DXmtF4t2.js} +113 -118
- package/dist/chunks/adTriggers-DXmtF4t2.js.map +1 -0
- package/dist/chunks/{index-DITXYcHx.js → ads-MCG5a6eK.js} +130 -125
- package/dist/chunks/ads-MCG5a6eK.js.map +1 -0
- package/dist/chunks/{index-BeJNpAyx.js → audio-LkYgd5Wq.js} +7 -7
- package/dist/chunks/audio-LkYgd5Wq.js.map +1 -0
- package/dist/chunks/{ScratchSound-0XKHUcJK.js → audioScratchSound-7XkwCCDm.js} +1 -1
- package/dist/chunks/audioScratchSound-7XkwCCDm.js.map +1 -0
- package/dist/chunks/{index-Miba3PD_.js → cast-bMrkGGuD.js} +70 -66
- package/dist/chunks/cast-bMrkGGuD.js.map +1 -0
- package/dist/chunks/{index-rENB3n9O.js → countdownScreen-CI-u6jjA.js} +1 -1
- package/dist/chunks/countdownScreen-CI-u6jjA.js.map +1 -0
- package/dist/chunks/{index-Q8FMOHj0.js → dai-B9Tth1Iv.js} +1 -1
- package/dist/chunks/dai-B9Tth1Iv.js.map +1 -0
- package/dist/chunks/{index-DCXX1ZJG.js → debugPanel-Bnc_7GOn.js} +1 -1
- package/dist/chunks/debugPanel-Bnc_7GOn.js.map +1 -0
- package/dist/chunks/{index-DXWK4EFa.js → dubbing-kNMPpyHl.js} +1 -1
- package/dist/chunks/dubbing-kNMPpyHl.js.map +1 -0
- package/dist/chunks/{index-BBmuCtKu.js → geoChecker-BRtvHwI-.js} +1 -1
- package/dist/chunks/geoChecker-BRtvHwI-.js.map +1 -0
- package/dist/chunks/{index-Ca8hocby.js → gesture-BzPCgi87.js} +1 -1
- package/dist/chunks/gesture-BzPCgi87.js.map +1 -0
- package/dist/chunks/{loadGpt-CmiAy366.js → gpt-CGXHTG_H.js} +1 -1
- package/dist/chunks/gpt-CGXHTG_H.js.map +1 -0
- package/dist/chunks/{index-3QALpwsf.js → inViewAutoplay-CRJe7GA4.js} +1 -1
- package/dist/chunks/inViewAutoplay-CRJe7GA4.js.map +1 -0
- package/dist/chunks/{index-7IBf8Y-R.js → liveWallClock-ChUTtzLD.js} +1 -1
- package/dist/chunks/liveWallClock-ChUTtzLD.js.map +1 -0
- package/dist/chunks/{index-f0vSgRIK.js → loopSection-CvF4l5uf.js} +1 -1
- package/dist/chunks/loopSection-CvF4l5uf.js.map +1 -0
- package/dist/chunks/{index-e00_M05B.js → markers-BhMJLPqj.js} +2 -2
- package/dist/chunks/markers-BhMJLPqj.js.map +1 -0
- package/dist/chunks/{index-CDPrkLq0.js → pauseAd-BQQe21X4.js} +2 -2
- package/dist/chunks/pauseAd-BQQe21X4.js.map +1 -0
- package/dist/chunks/{index-DEv3YqLg.js → player-DW5iWvPs.js} +939 -880
- package/dist/chunks/player-DW5iWvPs.js.map +1 -0
- package/dist/chunks/{index-D3Z7ZDLJ.js → playlist-DYGbJ5wz.js} +24 -24
- package/dist/chunks/playlist-DYGbJ5wz.js.map +1 -0
- package/dist/chunks/{VideoPrebid-CpckFzSq.js → prebid-CRY3i2OT.js} +1 -1
- package/dist/chunks/prebid-CRY3i2OT.js.map +1 -0
- package/dist/chunks/{index-DT8-oMPm.js → qrResume-DXwD3oSA.js} +29 -30
- package/dist/chunks/qrResume-DXwD3oSA.js.map +1 -0
- package/dist/chunks/redirectScreen-CSjrS8Kg.js +208 -0
- package/dist/chunks/redirectScreen-CSjrS8Kg.js.map +1 -0
- package/dist/chunks/{index-BbRYOSvk.js → rewardedUnlock-DZ_qPcDG.js} +22 -19
- package/dist/chunks/rewardedUnlock-DZ_qPcDG.js.map +1 -0
- package/dist/chunks/seekWhenReady-Clzne3-S.js +32 -0
- package/dist/chunks/seekWhenReady-Clzne3-S.js.map +1 -0
- package/dist/chunks/{index-CBX7bn-G.js → segments-LsZPlbYi.js} +2 -2
- package/dist/chunks/segments-LsZPlbYi.js.map +1 -0
- package/dist/chunks/{index-Ch3ep-eJ.js → sponsorship-BT21uwN5.js} +36 -41
- package/dist/chunks/sponsorship-BT21uwN5.js.map +1 -0
- package/dist/chunks/{index-BXSND_xN.js → spriteThumbnails-BQkEBRu-.js} +2 -2
- package/dist/chunks/spriteThumbnails-BQkEBRu-.js.map +1 -0
- package/dist/chunks/{index-DGtpFgHV.js → statsPanel-DSClIwA3.js} +1 -1
- package/dist/chunks/statsPanel-DSClIwA3.js.map +1 -0
- package/dist/chunks/{index-CDDke5rz.js → sticky-D_eLCNFk.js} +1 -1
- package/dist/chunks/sticky-D_eLCNFk.js.map +1 -0
- package/dist/chunks/{index-C3BQGcT3.js → story-H6f7gSoX.js} +27 -15
- package/dist/chunks/story-H6f7gSoX.js.map +1 -0
- package/dist/chunks/{index-C5oGMHF_.js → tapGestures-DrC42DiI.js} +1 -1
- package/dist/chunks/tapGestures-DrC42DiI.js.map +1 -0
- package/dist/chunks/trackingPixel-D2wxdCEz.js +20 -0
- package/dist/chunks/trackingPixel-D2wxdCEz.js.map +1 -0
- package/dist/controls/SeekBar.d.ts.map +1 -1
- package/dist/hls/SourceManager.d.ts.map +1 -1
- package/dist/hope-player.js +1 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/types.d.ts +3 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/keyboard/KeyboardController.d.ts.map +1 -1
- package/dist/plugins/ad-triggers/AdTriggers.d.ts.map +1 -1
- package/dist/plugins/ads/AdsController.d.ts.map +1 -1
- package/dist/plugins/ads/generateVastUrl.d.ts +10 -0
- package/dist/plugins/ads/generateVastUrl.d.ts.map +1 -1
- package/dist/plugins/cast/CastController.d.ts.map +1 -1
- package/dist/plugins/playlist/PlaylistRunner.d.ts.map +1 -1
- package/dist/plugins/qr-resume/QrResume.d.ts.map +1 -1
- package/dist/plugins/redirect-screen/RedirectScreen.d.ts +26 -3
- package/dist/plugins/redirect-screen/RedirectScreen.d.ts.map +1 -1
- package/dist/plugins/rewarded/RewardedUnlock.d.ts +0 -5
- package/dist/plugins/rewarded/RewardedUnlock.d.ts.map +1 -1
- package/dist/plugins/shared/seekWhenReady.d.ts +22 -0
- package/dist/plugins/shared/seekWhenReady.d.ts.map +1 -0
- package/dist/plugins/shared/trackingPixel.d.ts +8 -0
- package/dist/plugins/shared/trackingPixel.d.ts.map +1 -0
- package/dist/plugins/sponsorship/SponsorshipLayer.d.ts.map +1 -1
- package/dist/plugins/story/HopeStory.d.ts +2 -0
- package/dist/plugins/story/HopeStory.d.ts.map +1 -1
- package/dist/screens/ErrorScreen.d.ts +7 -0
- package/dist/screens/ErrorScreen.d.ts.map +1 -1
- package/dist/types/index.d.ts +49 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/media-error.d.ts +10 -0
- package/dist/utils/media-error.d.ts.map +1 -0
- package/dist/utils/seek-by.d.ts +8 -0
- package/dist/utils/seek-by.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/chunks/ScratchSound-0XKHUcJK.js.map +0 -1
- package/dist/chunks/VideoPrebid-CpckFzSq.js.map +0 -1
- package/dist/chunks/index-3QALpwsf.js.map +0 -1
- package/dist/chunks/index-7IBf8Y-R.js.map +0 -1
- package/dist/chunks/index-BBmuCtKu.js.map +0 -1
- package/dist/chunks/index-BXSND_xN.js.map +0 -1
- package/dist/chunks/index-BbRYOSvk.js.map +0 -1
- package/dist/chunks/index-BeJNpAyx.js.map +0 -1
- package/dist/chunks/index-C3BQGcT3.js.map +0 -1
- package/dist/chunks/index-C5oGMHF_.js.map +0 -1
- package/dist/chunks/index-CBX7bn-G.js.map +0 -1
- package/dist/chunks/index-CDDke5rz.js.map +0 -1
- package/dist/chunks/index-CDPrkLq0.js.map +0 -1
- package/dist/chunks/index-CWLyz1fp.js.map +0 -1
- package/dist/chunks/index-Ca8hocby.js.map +0 -1
- package/dist/chunks/index-Ch3ep-eJ.js.map +0 -1
- package/dist/chunks/index-D3Z7ZDLJ.js.map +0 -1
- package/dist/chunks/index-D6r-BGAV.js +0 -77
- package/dist/chunks/index-D6r-BGAV.js.map +0 -1
- package/dist/chunks/index-DCXX1ZJG.js.map +0 -1
- package/dist/chunks/index-DEv3YqLg.js.map +0 -1
- package/dist/chunks/index-DGtpFgHV.js.map +0 -1
- package/dist/chunks/index-DITXYcHx.js.map +0 -1
- package/dist/chunks/index-DT8-oMPm.js.map +0 -1
- package/dist/chunks/index-DXWK4EFa.js.map +0 -1
- package/dist/chunks/index-Miba3PD_.js.map +0 -1
- package/dist/chunks/index-Q8FMOHj0.js.map +0 -1
- package/dist/chunks/index-e00_M05B.js.map +0 -1
- package/dist/chunks/index-f0vSgRIK.js.map +0 -1
- package/dist/chunks/index-rENB3n9O.js.map +0 -1
- package/dist/chunks/loadGpt-CmiAy366.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
# @hopeplayer/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**An open-source, monetization-first video player** — a framework-agnostic `<hope-player>` custom element (Shadow DOM, TypeScript) with Google IMA, Prebid, rewarded ads, sponsorships, out-of-page ad triggers and Chromecast with TV ads built in. Every feature is its own lazy-loaded chunk: nothing you don't configure is downloaded.
|
|
4
4
|
|
|
5
|
-
Full docs, live demos
|
|
5
|
+
Full docs, live demos and the options reference: **[umutyaldiz.com/hopecoreplayer](https://umutyaldiz.com/hopecoreplayer)**
|
|
6
|
+
|
|
7
|
+
## Quick start (CDN, no build step)
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@hopeplayer/core@1/dist/hope-player.js"></script>
|
|
11
|
+
|
|
12
|
+
<hope-player src="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8" style="display:block;aspect-ratio:16/9"></hope-player>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use the full `…/dist/hope-player.js` path — plugins load as relative chunks next to it (unpkg and esm.sh work the same way).
|
|
6
16
|
|
|
7
17
|
## Install
|
|
8
18
|
|
|
@@ -13,24 +23,24 @@ npm install @hopeplayer/core
|
|
|
13
23
|
```ts
|
|
14
24
|
import '@hopeplayer/core';
|
|
15
25
|
|
|
16
|
-
document.querySelector('
|
|
17
|
-
src: '/video.
|
|
26
|
+
document.querySelector('hope-player').options = {
|
|
27
|
+
src: '/video.m3u8',
|
|
18
28
|
poster: '/poster.jpg',
|
|
29
|
+
ads: { adTagPreroll: 'https://pubads.g.doubleclick.net/gampad/ads?…' },
|
|
30
|
+
cast: { chromecast: true, airplay: true },
|
|
19
31
|
};
|
|
20
32
|
```
|
|
21
33
|
|
|
22
|
-
```html
|
|
23
|
-
<hope-player src="/video.mp4" poster="/poster.jpg"></hope-player>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
34
|
## Highlights
|
|
27
35
|
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
31
|
-
- **4
|
|
32
|
-
- **i18n
|
|
33
|
-
-
|
|
36
|
+
- **Playback:** MP4 / WebM / HLS (hls.js only when needed, native on Safari / iOS), live, fallback sources, quality and audio menus, captions, sprite thumbnails, chapters, playlist and story mode, audio player, PiP, Chromecast and AirPlay.
|
|
37
|
+
- **Monetization:** Google IMA (VAST / VMAP, overlays, OM SDK, SCTE-35, DAI), Prebid video with GAM `cust_params`, consent (TCF / USP / GPP), rewarded quality unlock, sponsorship layer, pause ads, rule-driven Ad Manager out-of-page ads — and ads keep playing on the TV when casting.
|
|
38
|
+
- **Shadow DOM** — styles never leak into (or get overridden by) the host page.
|
|
39
|
+
- **4 style presets** plus CSS custom properties (`--hp-color-accent`…) and `::part()` hooks.
|
|
40
|
+
- **i18n** — every label and ad-UI string follows `locale` / `labels`.
|
|
41
|
+
- **Wrappers:** [`@hopeplayer/react`](https://www.npmjs.com/package/@hopeplayer/react), [`@hopeplayer/vue`](https://www.npmjs.com/package/@hopeplayer/vue), [`@hopeplayer/react-native`](https://www.npmjs.com/package/@hopeplayer/react-native).
|
|
42
|
+
|
|
43
|
+
[Changelog](https://github.com/umutyaldiz/hopecoreplayer/blob/main/CHANGELOG.md) · [Contributing](https://github.com/umutyaldiz/hopecoreplayer/blob/main/CONTRIBUTING.md) · [Issues](https://github.com/umutyaldiz/hopecoreplayer/issues)
|
|
34
44
|
|
|
35
45
|
## License
|
|
36
46
|
|
|
@@ -86,6 +86,7 @@ export declare class HopePlayerElement extends HTMLElement {
|
|
|
86
86
|
private countdownScreen;
|
|
87
87
|
private geoChecker;
|
|
88
88
|
private redirectScreen;
|
|
89
|
+
private redirectKey;
|
|
89
90
|
private qrResume;
|
|
90
91
|
private pauseAd;
|
|
91
92
|
private adTriggers;
|
|
@@ -270,6 +271,8 @@ export declare class HopePlayerElement extends HTMLElement {
|
|
|
270
271
|
private get isChromeFullyHidden();
|
|
271
272
|
private readonly onPlay;
|
|
272
273
|
private readonly onPause;
|
|
274
|
+
private readonly onEnded;
|
|
275
|
+
private readonly onRateChange;
|
|
273
276
|
private readonly onPointerDownFocus;
|
|
274
277
|
private readonly onVideoPressStart;
|
|
275
278
|
private readonly onVideoPressEnd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HopePlayerElement.d.ts","sourceRoot":"","sources":["../src/HopePlayerElement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAuC,KAAK,kBAAkB,EAA+C,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"HopePlayerElement.d.ts","sourceRoot":"","sources":["../src/HopePlayerElement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,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AAQ,GAAG,SAAoB,GAAG,IAAI;IAgBrE,gGAAgG;IAChG,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IA0BhC,yIAAyI;IACzI,cAAc,IAAI,IAAI;IAMtB,aAAa,IAAI,IAAI;IAMrB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAY5B;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAK7B;IAEF,uIAAuI;IACvI,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,UAAU;IAMlB,wGAAwG;YAC1F,cAAc;IAoC5B,yFAAyF;IACzF,OAAO,CAAC,cAAc;IAqDtB,8GAA8G;IAC9G,OAAO,CAAC,mBAAmB;IAU3B,wFAAwF;IACxF,OAAO,CAAC,iBAAiB;IAMzB,+GAA+G;IAC/G,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAW/B;CACL"}
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
var T = Object.defineProperty;
|
|
2
|
-
var x = (
|
|
3
|
-
var c = (
|
|
4
|
-
import {
|
|
2
|
+
var x = (l, e, t) => e in l ? T(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
|
|
3
|
+
var c = (l, e, t) => x(l, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { f as b } from "./trackingPixel-D2wxdCEz.js";
|
|
5
|
+
import { l as L } from "./gpt-CGXHTG_H.js";
|
|
5
6
|
const C = 5e3, F = 8e3, P = 30, U = ["none", "full", "center", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"], N = ["time", "interval", "percent", "fullscreen", "fullscreenExit", "start", "pause", "resume", "ended"], R = 1.5;
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
if (typeof
|
|
7
|
+
let D = 0;
|
|
8
|
+
function M(l) {
|
|
9
|
+
if (typeof l != "string" || !l.trim()) return null;
|
|
9
10
|
try {
|
|
10
|
-
const e = new URL(
|
|
11
|
+
const e = new URL(l, document.baseURI);
|
|
11
12
|
return e.protocol === "https:" || e.protocol === "http:" ? e.href : null;
|
|
12
13
|
} catch {
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
const p = (
|
|
17
|
-
function y(
|
|
17
|
+
const p = (l, e, t) => typeof l == "number" && Number.isFinite(l) ? Math.min(t, Math.max(e, l)) : void 0, k = (l) => typeof l == "string" ? l.slice(0, 200) : typeof l == "number" && Number.isFinite(l) || typeof l == "boolean" ? String(l) : null;
|
|
18
|
+
function y(l) {
|
|
18
19
|
let e;
|
|
19
|
-
if (typeof
|
|
20
|
-
if (!
|
|
21
|
-
e = [...new URLSearchParams(
|
|
22
|
-
} else if (
|
|
23
|
-
e = Object.entries(
|
|
20
|
+
if (typeof l == "string") {
|
|
21
|
+
if (!l.trim()) return;
|
|
22
|
+
e = [...new URLSearchParams(l.trim().replace(/^\?/, "")).entries()].map(([s, i]) => [s, i.includes(",") ? i.split(",") : i]);
|
|
23
|
+
} else if (l && typeof l == "object" && !Array.isArray(l))
|
|
24
|
+
e = Object.entries(l);
|
|
24
25
|
else
|
|
25
26
|
return;
|
|
26
27
|
const t = {};
|
|
27
28
|
for (const [s, i] of e.slice(0, 50))
|
|
28
29
|
if (/^[\w.-]{1,40}$/.test(s))
|
|
29
30
|
if (Array.isArray(i)) {
|
|
30
|
-
const
|
|
31
|
-
|
|
31
|
+
const n = i.map(k).filter((a) => a !== null && a !== "").slice(0, 30);
|
|
32
|
+
n.length && (t[s] = n);
|
|
32
33
|
} else {
|
|
33
|
-
const
|
|
34
|
-
|
|
34
|
+
const n = k(i);
|
|
35
|
+
n !== null && n !== "" && (t[s] = n);
|
|
35
36
|
}
|
|
36
37
|
return Object.keys(t).length ? t : void 0;
|
|
37
38
|
}
|
|
38
|
-
function O(
|
|
39
|
-
if (!
|
|
40
|
-
const e =
|
|
39
|
+
function O(l) {
|
|
40
|
+
if (!l || typeof l != "object") return null;
|
|
41
|
+
const e = l, t = e.type;
|
|
41
42
|
if (!N.includes(t)) return null;
|
|
42
|
-
const s = (i,
|
|
43
|
+
const s = (i, n, a) => (Array.isArray(i) ? i : [i]).map((o) => p(o, n, a)).filter((o) => o !== void 0).slice(0, 50);
|
|
43
44
|
if (t === "time") {
|
|
44
45
|
const i = s(e.at, 0, 86400);
|
|
45
46
|
return i.length ? { type: t, at: i } : null;
|
|
@@ -54,56 +55,50 @@ function O(a) {
|
|
|
54
55
|
}
|
|
55
56
|
return { type: t, delay: p(e.delay, 0, 600) };
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
+
function S(l) {
|
|
58
59
|
var o, d, h;
|
|
59
|
-
if (!
|
|
60
|
-
const e =
|
|
60
|
+
if (!l || typeof l != "object") return null;
|
|
61
|
+
const e = l;
|
|
61
62
|
if (e.active !== !0 || !Array.isArray(e.rules)) return null;
|
|
62
63
|
const t = Date.now(), s = e.validFrom ? Date.parse(e.validFrom) : NaN, i = e.validUntil ? Date.parse(e.validUntil) : NaN;
|
|
63
64
|
if (Number.isFinite(s) && t < s || Number.isFinite(i) && t > i) return null;
|
|
64
|
-
const
|
|
65
|
+
const n = (u) => Array.isArray(u) ? u.map(M).filter((r) => !!r).slice(0, 10) : [], a = [];
|
|
65
66
|
for (const u of e.rules.slice(0, 20)) {
|
|
66
67
|
if (!u || typeof u != "object") continue;
|
|
67
|
-
const
|
|
68
|
-
if (typeof
|
|
69
|
-
const f = (Array.isArray(
|
|
68
|
+
const r = u;
|
|
69
|
+
if (typeof r.adUnitPath != "string" || !/^\/\d+(?:[,/][\w.\-/]*)?$/.test(r.adUnitPath)) continue;
|
|
70
|
+
const f = (Array.isArray(r.triggers) ? r.triggers : []).map(O).filter((v) => !!v).slice(0, 20);
|
|
70
71
|
if (!f.length) continue;
|
|
71
|
-
const g = Array.isArray(
|
|
72
|
-
|
|
73
|
-
id: typeof
|
|
74
|
-
adUnitPath:
|
|
75
|
-
mode:
|
|
72
|
+
const g = Array.isArray(r.size) && r.size.length === 2 ? [p(r.size[0], 1, 4e3), p(r.size[1], 1, 4e3)] : null, m = U.includes(r.layout) ? r.layout : "none";
|
|
73
|
+
a.push({
|
|
74
|
+
id: typeof r.id == "string" ? r.id.slice(0, 80) : void 0,
|
|
75
|
+
adUnitPath: r.adUnitPath,
|
|
76
|
+
mode: r.mode === "fullscreen" || r.mode === "normal" ? r.mode : "any",
|
|
76
77
|
triggers: f,
|
|
77
|
-
targeting: y(
|
|
78
|
+
targeting: y(r.targeting),
|
|
78
79
|
// API'lerde yaygın `cust_params` yazımı da kabul edilir.
|
|
79
|
-
custParams: y(
|
|
80
|
+
custParams: y(r.custParams ?? r.cust_params),
|
|
80
81
|
layout: m,
|
|
81
82
|
size: g && g[0] && g[1] ? [g[0], g[1]] : void 0,
|
|
82
|
-
backdrop: typeof
|
|
83
|
-
pauseContent:
|
|
84
|
-
closeButton:
|
|
85
|
-
closeDelay: p(
|
|
86
|
-
duration: p(
|
|
87
|
-
label:
|
|
88
|
-
maxShows: p(
|
|
89
|
-
minGapSeconds: p(
|
|
90
|
-
minPlayerWidth: p(
|
|
91
|
-
tracking: { impression:
|
|
83
|
+
backdrop: typeof r.backdrop == "boolean" ? r.backdrop : m === "full",
|
|
84
|
+
pauseContent: r.pauseContent === !0,
|
|
85
|
+
closeButton: r.closeButton !== !1,
|
|
86
|
+
closeDelay: p(r.closeDelay, 0, 120) ?? 0,
|
|
87
|
+
duration: p(r.duration, 1, 3600),
|
|
88
|
+
label: r.label === !1 ? !1 : typeof r.label == "string" ? r.label.slice(0, 40) : void 0,
|
|
89
|
+
maxShows: p(r.maxShows, 1, 1e3),
|
|
90
|
+
minGapSeconds: p(r.minGapSeconds, 0, 86400),
|
|
91
|
+
minPlayerWidth: p(r.minPlayerWidth, 0, 4e3),
|
|
92
|
+
tracking: { impression: n((o = r.tracking) == null ? void 0 : o.impression), close: n((d = r.tracking) == null ? void 0 : d.close), empty: n((h = r.tracking) == null ? void 0 : h.empty) }
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
|
-
return
|
|
95
|
+
return a.length ? {
|
|
95
96
|
active: !0,
|
|
96
97
|
id: typeof e.id == "string" ? e.id.slice(0, 120) : void 0,
|
|
97
98
|
minGapSeconds: p(e.minGapSeconds, 0, 86400) ?? P,
|
|
98
|
-
rules:
|
|
99
|
+
rules: a
|
|
99
100
|
} : null;
|
|
100
101
|
}
|
|
101
|
-
function S(a) {
|
|
102
|
-
for (const e of a ?? []) {
|
|
103
|
-
const t = new Image();
|
|
104
|
-
t.referrerPolicy = "no-referrer-when-downgrade", t.src = e;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
102
|
class $ {
|
|
108
103
|
constructor(e, t) {
|
|
109
104
|
c(this, "options");
|
|
@@ -111,7 +106,7 @@ class $ {
|
|
|
111
106
|
c(this, "loaded", !1);
|
|
112
107
|
c(this, "googletag", null);
|
|
113
108
|
c(this, "showing", null);
|
|
114
|
-
c(this, "instance", ++
|
|
109
|
+
c(this, "instance", ++D);
|
|
115
110
|
c(this, "seq", 0);
|
|
116
111
|
c(this, "requestSeq", 0);
|
|
117
112
|
c(this, "destroyed", !1);
|
|
@@ -172,13 +167,13 @@ class $ {
|
|
|
172
167
|
this.lastPos = t;
|
|
173
168
|
const i = this.config;
|
|
174
169
|
if (!i || e.paused || e.seeking || this.isLive() || this.ctx.isBlocked() || t <= s || t - s > R) return;
|
|
175
|
-
const
|
|
170
|
+
const n = e.duration;
|
|
176
171
|
i.rules.forEach(
|
|
177
|
-
(
|
|
172
|
+
(a, o) => a.triggers.forEach((d, h) => {
|
|
178
173
|
if (!(d.type !== "time" && d.type !== "percent"))
|
|
179
174
|
for (const u of d.at) {
|
|
180
|
-
const
|
|
181
|
-
s <
|
|
175
|
+
const r = d.type === "percent" ? Number.isFinite(n) && n > 0 ? n * u / 100 : NaN : u, f = `${o}:${h}:${u}`;
|
|
176
|
+
s < r && r <= t && !this.fired.has(f) && (this.fired.add(f), this.showRule(o, d.type));
|
|
182
177
|
}
|
|
183
178
|
})
|
|
184
179
|
);
|
|
@@ -190,18 +185,18 @@ class $ {
|
|
|
190
185
|
this.lastTick = e;
|
|
191
186
|
const s = this.ctx.videoEl, i = this.config;
|
|
192
187
|
if (!i || s.paused || s.ended || document.hidden || this.ctx.isBlocked() || (o = this.showing) != null && o.filled) return;
|
|
193
|
-
const
|
|
188
|
+
const n = this.watchedMs / 1e3;
|
|
194
189
|
this.watchedMs += t;
|
|
195
|
-
const
|
|
190
|
+
const a = this.watchedMs / 1e3;
|
|
196
191
|
i.rules.forEach(
|
|
197
|
-
(d, h) => d.triggers.forEach((u,
|
|
192
|
+
(d, h) => d.triggers.forEach((u, r) => {
|
|
198
193
|
if (u.type === "interval") {
|
|
199
|
-
const f = u.startAfter ?? u.every, g = Math.floor((
|
|
200
|
-
|
|
194
|
+
const f = u.startAfter ?? u.every, g = Math.floor((a - f) / u.every);
|
|
195
|
+
a >= f && f + g * u.every > n && this.showRule(h, "interval");
|
|
201
196
|
} else if (u.type === "time" && this.isLive())
|
|
202
197
|
for (const f of u.at) {
|
|
203
|
-
const g = `${h}:${
|
|
204
|
-
|
|
198
|
+
const g = `${h}:${r}:${f}:live`;
|
|
199
|
+
n < f && f <= a && !this.fired.has(g) && (this.fired.add(g), this.showRule(h, "time"));
|
|
205
200
|
}
|
|
206
201
|
})
|
|
207
202
|
);
|
|
@@ -231,23 +226,23 @@ class $ {
|
|
|
231
226
|
async load() {
|
|
232
227
|
const e = ++this.requestSeq;
|
|
233
228
|
if (!this.options.endpoint) {
|
|
234
|
-
this.apply(
|
|
229
|
+
this.apply(S(this.options.config));
|
|
235
230
|
return;
|
|
236
231
|
}
|
|
237
232
|
const t = typeof AbortController < "u" ? new AbortController() : null, s = setTimeout(() => t == null ? void 0 : t.abort(), this.options.timeoutMs ?? C);
|
|
238
233
|
let i = "";
|
|
239
234
|
try {
|
|
240
|
-
const
|
|
241
|
-
for (const [d, h] of Object.entries(this.options.params ?? {}))
|
|
242
|
-
i =
|
|
243
|
-
const
|
|
244
|
-
if (!
|
|
245
|
-
const o = await
|
|
235
|
+
const n = new URL(this.options.endpoint, document.baseURI);
|
|
236
|
+
for (const [d, h] of Object.entries(this.options.params ?? {})) n.searchParams.set(d, h);
|
|
237
|
+
i = n.href;
|
|
238
|
+
const a = await fetch(i, { ...this.options.fetchInit, signal: t == null ? void 0 : t.signal });
|
|
239
|
+
if (!a.ok) throw new Error(`HTTP ${a.status}`);
|
|
240
|
+
const o = await a.json();
|
|
246
241
|
if (this.destroyed || e !== this.requestSeq) return;
|
|
247
|
-
this.apply(
|
|
248
|
-
} catch (
|
|
242
|
+
this.apply(S(o));
|
|
243
|
+
} catch (n) {
|
|
249
244
|
if (this.destroyed || e !== this.requestSeq) return;
|
|
250
|
-
this.ctx.log({ message: `Ad triggers API failed: ${String(
|
|
245
|
+
this.ctx.log({ message: `Ad triggers API failed: ${String(n)}`, details: { url: i } }), !this.config && this.options.config && this.apply(S(this.options.config));
|
|
251
246
|
} finally {
|
|
252
247
|
clearTimeout(s);
|
|
253
248
|
}
|
|
@@ -263,16 +258,16 @@ class $ {
|
|
|
263
258
|
trigger(e) {
|
|
264
259
|
const t = this.config;
|
|
265
260
|
t && t.rules.forEach((s, i) => {
|
|
266
|
-
const
|
|
267
|
-
if (!
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
261
|
+
const n = s.triggers.find((d) => d.type === e);
|
|
262
|
+
if (!n) return;
|
|
263
|
+
const a = (n.delay ?? 0) * 1e3;
|
|
264
|
+
if (a <= 0) {
|
|
270
265
|
this.showRule(i, e);
|
|
271
266
|
return;
|
|
272
267
|
}
|
|
273
268
|
const o = setTimeout(() => {
|
|
274
269
|
this.delayed = this.delayed.filter((d) => d.timer !== o), this.showRule(i, e);
|
|
275
|
-
},
|
|
270
|
+
}, a);
|
|
276
271
|
this.delayed.push({ type: e, timer: o });
|
|
277
272
|
});
|
|
278
273
|
}
|
|
@@ -285,35 +280,35 @@ class $ {
|
|
|
285
280
|
var d, h;
|
|
286
281
|
const s = (d = this.config) == null ? void 0 : d.rules[e];
|
|
287
282
|
if (!s || this.destroyed) return;
|
|
288
|
-
const i = this.ctx.videoEl,
|
|
289
|
-
if (this.showing && !(this.showing.filled && this.showing.rule.layout === "none")) return
|
|
290
|
-
if (this.ctx.isBlocked()) return
|
|
291
|
-
if (document.hidden) return
|
|
292
|
-
if (this.ctx.isNativeFullscreen()) return
|
|
293
|
-
if (s.mode === "fullscreen" && !
|
|
294
|
-
if (s.mode === "normal" &&
|
|
283
|
+
const i = this.ctx.videoEl, n = this.ctx.isFullscreen(), a = (u) => this.ctx.log({ message: `Ad trigger skipped (${u})`, details: { rule: s.id, trigger: t } });
|
|
284
|
+
if (this.showing && !(this.showing.filled && this.showing.rule.layout === "none")) return a("another ad is showing");
|
|
285
|
+
if (this.ctx.isBlocked()) return a("video ad / intro screen");
|
|
286
|
+
if (document.hidden) return a("tab hidden");
|
|
287
|
+
if (this.ctx.isNativeFullscreen()) return a("native iOS fullscreen");
|
|
288
|
+
if (s.mode === "fullscreen" && !n) return a("not fullscreen");
|
|
289
|
+
if (s.mode === "normal" && n) return a("fullscreen");
|
|
295
290
|
if (t === "pause" && (!i.paused || i.ended) || t === "ended" && !i.ended || ["time", "percent", "interval", "start", "resume"].includes(t) && i.paused) return;
|
|
296
|
-
if (s.minPlayerWidth && this.ctx.overlayEl.getBoundingClientRect().width < s.minPlayerWidth) return
|
|
291
|
+
if (s.minPlayerWidth && this.ctx.overlayEl.getBoundingClientRect().width < s.minPlayerWidth) return a("player too narrow");
|
|
297
292
|
const o = Date.now();
|
|
298
|
-
if (s.maxShows && (this.shows.get(e) ?? 0) >= s.maxShows) return
|
|
299
|
-
if (s.minGapSeconds && o - (this.lastShownAt.get(e) ?? 0) < s.minGapSeconds * 1e3) return
|
|
300
|
-
if (o - this.lastAnyAt < (((h = this.config) == null ? void 0 : h.minGapSeconds) ?? P) * 1e3) return
|
|
301
|
-
this.showing && this.close("replaced"), this.lastAnyAt = o, this.lastShownAt.set(e, o), this.request(e, s, t,
|
|
293
|
+
if (s.maxShows && (this.shows.get(e) ?? 0) >= s.maxShows) return a("maxShows");
|
|
294
|
+
if (s.minGapSeconds && o - (this.lastShownAt.get(e) ?? 0) < s.minGapSeconds * 1e3) return a("rule minGapSeconds");
|
|
295
|
+
if (o - this.lastAnyAt < (((h = this.config) == null ? void 0 : h.minGapSeconds) ?? P) * 1e3) return a("minGapSeconds");
|
|
296
|
+
this.showing && this.close("replaced"), this.lastAnyAt = o, this.lastShownAt.set(e, o), this.request(e, s, t, n);
|
|
302
297
|
}
|
|
303
298
|
async request(e, t, s, i) {
|
|
304
|
-
const
|
|
305
|
-
d.id = `hp-adtrigger-${this.instance}-${
|
|
299
|
+
const n = ++this.seq, a = `hp-adtrigger-${this.instance}`, o = this.buildBox(t, a), d = document.createElement("div");
|
|
300
|
+
d.id = `hp-adtrigger-${this.instance}-${n}`, d.slot = a;
|
|
306
301
|
const h = { rule: t, trigger: s, box: o, adHost: d, slot: null, filled: !1, pausedContent: !1, timers: [] };
|
|
307
302
|
this.showing = h, this.ctx.overlayEl.appendChild(o), this.ctx.hostEl.appendChild(d);
|
|
308
|
-
const u = { rule: t.id, trigger: s, adUnitPath: t.adUnitPath },
|
|
303
|
+
const u = { rule: t.id, trigger: s, adUnitPath: t.adUnitPath }, r = (g) => {
|
|
309
304
|
var m;
|
|
310
|
-
this.showing === h && (this.ctx.log({ message: `Ad trigger: no ad (${g})`, details: { ...u } }),
|
|
305
|
+
this.showing === h && (this.ctx.log({ message: `Ad trigger: no ad (${g})`, details: { ...u } }), b((m = t.tracking) == null ? void 0 : m.empty), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:adtriggerempty", { detail: u })), this.teardown(h));
|
|
311
306
|
};
|
|
312
|
-
h.timers.push(setTimeout(() => !h.filled &&
|
|
307
|
+
h.timers.push(setTimeout(() => !h.filled && r("timeout"), this.options.renderTimeoutMs ?? F));
|
|
313
308
|
try {
|
|
314
309
|
this.googletag ?? (this.googletag = await L());
|
|
315
310
|
} catch (g) {
|
|
316
|
-
|
|
311
|
+
r(String(g));
|
|
317
312
|
return;
|
|
318
313
|
}
|
|
319
314
|
if (this.showing !== h) return;
|
|
@@ -322,7 +317,7 @@ class $ {
|
|
|
322
317
|
if (this.showing !== h) return;
|
|
323
318
|
const g = f.defineOutOfPageSlot(t.adUnitPath, d.id);
|
|
324
319
|
if (!g) {
|
|
325
|
-
|
|
320
|
+
r("slot could not be defined");
|
|
326
321
|
return;
|
|
327
322
|
}
|
|
328
323
|
h.slot = g, g.addService(f.pubads());
|
|
@@ -339,7 +334,7 @@ class $ {
|
|
|
339
334
|
h.custParams = m;
|
|
340
335
|
const v = (w) => {
|
|
341
336
|
var E, A;
|
|
342
|
-
w.slot === g && ((A = (E = f.pubads()).removeEventListener) == null || A.call(E, "slotRenderEnded", v), w.isEmpty ?
|
|
337
|
+
w.slot === g && ((A = (E = f.pubads()).removeEventListener) == null || A.call(E, "slotRenderEnded", v), w.isEmpty ? r("empty") : this.reveal(e, h, i));
|
|
343
338
|
};
|
|
344
339
|
f.pubads().addEventListener("slotRenderEnded", v), f.enableServices(), f.display(d.id), f.pubads().isInitialLoadDisabled() && f.pubads().refresh([g]);
|
|
345
340
|
});
|
|
@@ -349,17 +344,17 @@ class $ {
|
|
|
349
344
|
s.className = "hp-adtrigger", s.setAttribute("part", "ad-trigger");
|
|
350
345
|
const i = e.layout === "none";
|
|
351
346
|
s.setAttribute("data-layout", e.layout ?? "none"), s.toggleAttribute("data-backdrop", !!e.backdrop);
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
347
|
+
const n = document.createElement("div");
|
|
348
|
+
if (n.className = "hp-adtrigger-frame", e.size && e.layout !== "full" && (n.style.setProperty("--hp-adtrigger-w", `${e.size[0]}px`), n.style.setProperty("--hp-adtrigger-h", `${e.size[1]}px`), n.setAttribute("data-sized", "")), e.label !== !1 && !i) {
|
|
354
349
|
const o = document.createElement("span");
|
|
355
|
-
o.className = "hp-adtrigger-label", o.textContent = e.label || this.ctx.i18n.adTriggerLabel,
|
|
350
|
+
o.className = "hp-adtrigger-label", o.textContent = e.label || this.ctx.i18n.adTriggerLabel, n.appendChild(o);
|
|
356
351
|
}
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
352
|
+
const a = document.createElement("slot");
|
|
353
|
+
if (a.name = t, n.appendChild(a), e.closeButton !== !1 && !i) {
|
|
359
354
|
const o = document.createElement("button");
|
|
360
|
-
o.type = "button", o.className = "hp-adtrigger-close", o.setAttribute("part", "ad-trigger-close"), o.setAttribute("aria-label", this.ctx.i18n.pauseAdClose), o.hidden = !0, o.innerHTML = '<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>', o.addEventListener("click", () => this.close("user")),
|
|
355
|
+
o.type = "button", o.className = "hp-adtrigger-close", o.setAttribute("part", "ad-trigger-close"), o.setAttribute("aria-label", this.ctx.i18n.pauseAdClose), o.hidden = !0, o.innerHTML = '<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>', o.addEventListener("click", () => this.close("user")), n.appendChild(o);
|
|
361
356
|
}
|
|
362
|
-
s.appendChild(
|
|
357
|
+
s.appendChild(n);
|
|
363
358
|
for (const o of ["pointerdown", "click", "dblclick"]) s.addEventListener(o, (d) => d.stopPropagation());
|
|
364
359
|
return s;
|
|
365
360
|
}
|
|
@@ -372,10 +367,10 @@ class $ {
|
|
|
372
367
|
d && Object.assign(d.style, { width: "100%", height: "100%", border: "0" }), Object.assign(t.adHost.style, { width: "100%", height: "100%" });
|
|
373
368
|
}
|
|
374
369
|
t.box.setAttribute("data-open", "");
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
i.pauseContent && !
|
|
370
|
+
const n = t.box.querySelector(".hp-adtrigger-close");
|
|
371
|
+
n && !i.closeDelay ? n.hidden = !1 : n && t.timers.push(setTimeout(() => n.hidden = !1, i.closeDelay * 1e3)), i.duration && t.timers.push(setTimeout(() => this.close("timeout"), i.duration * 1e3));
|
|
372
|
+
const a = this.ctx.videoEl;
|
|
373
|
+
i.pauseContent && !a.paused && (t.pausedContent = !0, this.selfPause = !0, a.pause()), b((o = i.tracking) == null ? void 0 : o.impression), this.ctx.hostEl.dispatchEvent(
|
|
379
374
|
new CustomEvent("hp:adtriggershow", { detail: { rule: i.id, trigger: t.trigger, adUnitPath: i.adUnitPath, fullscreen: s, custParams: t.custParams ?? {} } })
|
|
380
375
|
);
|
|
381
376
|
}
|
|
@@ -385,7 +380,7 @@ class $ {
|
|
|
385
380
|
const t = this.showing;
|
|
386
381
|
if (!t) return;
|
|
387
382
|
const s = t.filled;
|
|
388
|
-
this.teardown(t), s && (
|
|
383
|
+
this.teardown(t), s && (b((i = t.rule.tracking) == null ? void 0 : i.close), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:adtriggerclose", { detail: { rule: t.rule.id, reason: e } })), t.pausedContent && e !== "content" && e !== "ad" && this.ctx.videoEl.play().catch(() => {
|
|
389
384
|
}));
|
|
390
385
|
}
|
|
391
386
|
teardown(e) {
|
|
@@ -404,12 +399,12 @@ class $ {
|
|
|
404
399
|
e.removeEventListener("timeupdate", this.onTimeUpdate), e.removeEventListener("seeked", this.onSeeked), e.removeEventListener("playing", this.onPlaying), e.removeEventListener("pause", this.onPause), e.removeEventListener("ended", this.onEnded), e.removeEventListener("loadstart", this.onLoadStart), e.removeEventListener("webkitbeginfullscreen", this.onFullscreenChange), e.removeEventListener("webkitendfullscreen", this.onFullscreenChange), document.removeEventListener("fullscreenchange", this.onFullscreenChange), document.removeEventListener("webkitfullscreenchange", this.onFullscreenChange), this.ctx.hostEl.removeEventListener("hp:adstart", this.onVideoAdStart);
|
|
405
400
|
}
|
|
406
401
|
}
|
|
407
|
-
function
|
|
408
|
-
return new $(
|
|
402
|
+
function G(l, e) {
|
|
403
|
+
return new $(l, e);
|
|
409
404
|
}
|
|
410
405
|
export {
|
|
411
406
|
$ as AdTriggers,
|
|
412
|
-
|
|
413
|
-
|
|
407
|
+
G as installAdTriggers,
|
|
408
|
+
S as normalizeAdTriggers
|
|
414
409
|
};
|
|
415
|
-
//# sourceMappingURL=
|
|
410
|
+
//# sourceMappingURL=adTriggers-DXmtF4t2.js.map
|