@hopeplayer/vue 1.1.0 → 1.2.0
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/dist/hope-player-vue.js +17 -15
- package/dist/hope-player-vue.js.map +1 -1
- package/package.json +3 -3
package/dist/hope-player-vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as h, ref as m, onMounted as
|
|
1
|
+
import { defineComponent as h, ref as m, onMounted as B, watch as b, onBeforeUnmount as f, openBlock as g, createElementBlock as k } from "vue";
|
|
2
2
|
const O = /* @__PURE__ */ h({
|
|
3
3
|
__name: "HopePlayer",
|
|
4
4
|
props: {
|
|
@@ -44,6 +44,8 @@ const O = /* @__PURE__ */ h({
|
|
|
44
44
|
markers: {},
|
|
45
45
|
segments: {},
|
|
46
46
|
skipSegments: {},
|
|
47
|
+
accessibility: { type: [Boolean, Object] },
|
|
48
|
+
history: { type: [Boolean, Object] },
|
|
47
49
|
spriteThumbnails: {},
|
|
48
50
|
countdownScreen: {},
|
|
49
51
|
geoChecker: {},
|
|
@@ -56,12 +58,12 @@ const O = /* @__PURE__ */ h({
|
|
|
56
58
|
},
|
|
57
59
|
emits: ["ready", "play", "pause", "ended", "error", "qualitychange", "ratechange", "adstart", "adend", "aderror", "itemchange", "sticky", "sourcefallback"],
|
|
58
60
|
setup(p, { expose: i, emit: c }) {
|
|
59
|
-
const
|
|
60
|
-
let s = !1,
|
|
61
|
-
|
|
61
|
+
const l = p, t = c, o = m(null);
|
|
62
|
+
let s = !1, r = [];
|
|
63
|
+
B(() => {
|
|
62
64
|
const a = o.value;
|
|
63
65
|
if (a) {
|
|
64
|
-
|
|
66
|
+
r = [
|
|
65
67
|
["hp:ready", () => t("ready")],
|
|
66
68
|
["hp:play", () => t("play")],
|
|
67
69
|
["hp:pause", () => t("pause")],
|
|
@@ -88,33 +90,33 @@ const O = /* @__PURE__ */ h({
|
|
|
88
90
|
],
|
|
89
91
|
["hp:sourcefallback", (e) => t("sourcefallback", e.detail)]
|
|
90
92
|
];
|
|
91
|
-
for (const [e, n] of
|
|
93
|
+
for (const [e, n] of r) a.addEventListener(e, n);
|
|
92
94
|
import("@hopeplayer/core").then(() => {
|
|
93
|
-
s || !o.value || (o.value.options = { ...
|
|
95
|
+
s || !o.value || (o.value.options = { ...l });
|
|
94
96
|
});
|
|
95
97
|
}
|
|
96
|
-
}),
|
|
97
|
-
() => JSON.stringify(
|
|
98
|
+
}), b(
|
|
99
|
+
() => JSON.stringify(l),
|
|
98
100
|
() => {
|
|
99
|
-
o.value && (o.value.options = { ...
|
|
101
|
+
o.value && (o.value.options = { ...l });
|
|
100
102
|
}
|
|
101
|
-
),
|
|
103
|
+
), f(() => {
|
|
102
104
|
s = !0;
|
|
103
105
|
const a = o.value;
|
|
104
|
-
if (a) for (const [e, n] of
|
|
106
|
+
if (a) for (const [e, n] of r) a.removeEventListener(e, n);
|
|
105
107
|
});
|
|
106
108
|
function d() {
|
|
107
109
|
var a;
|
|
108
110
|
return ((a = o.value) == null ? void 0 : a.play()) ?? Promise.resolve();
|
|
109
111
|
}
|
|
110
|
-
function
|
|
112
|
+
function y() {
|
|
111
113
|
var a;
|
|
112
114
|
(a = o.value) == null || a.pause();
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function u() {
|
|
115
117
|
return o.value;
|
|
116
118
|
}
|
|
117
|
-
return i({ play: d, pause:
|
|
119
|
+
return i({ play: d, pause: y, getElement: u }), (a, e) => (g(), k("hope-player", {
|
|
118
120
|
ref_key: "elRef",
|
|
119
121
|
ref: o
|
|
120
122
|
}, null, 512));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hope-player-vue.js","sources":["../src/HopePlayer.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// <hope-player> için ince Vue sarmalayıcı: prop'ları `.options`'a yazar, `hp:*` event'lerini emit'lere çevirir.\n// class/style Vue'nun fallthrough attribute'larıyla köke geçer. Core `onMounted` içinde dinamik import edilir —\n// statik import `HTMLElement` olmayan SSR'da (Nuxt) çöker.\nimport { ref, onMounted, onBeforeUnmount, watch } from 'vue';\nimport type { HopePlayerElement as HopePlayerEl, HopePlayerEventMap, HopePlayerOptions, StickyCorner } from '@hopeplayer/core';\n\nconst props = defineProps<HopePlayerOptions>();\n\nconst emit = defineEmits<{\n ready: [];\n play: [];\n pause: [];\n ended: [];\n error: [message: string];\n qualitychange: [label: string];\n ratechange: [rate: number];\n adstart: [type: 'preroll' | 'midroll' | 'postroll'];\n adend: [type: 'preroll' | 'midroll' | 'postroll'];\n aderror: [message: string];\n itemchange: [index: number, source: 'playlist' | 'story'];\n sticky: [sticky: boolean, corner: StickyCorner | undefined];\n sourcefallback: [detail: HopePlayerEventMap['hp:sourcefallback']['detail']];\n}>();\n\nconst elRef = ref<HopePlayerEl | null>(null);\nlet cancelled = false;\nlet listeners: Array<[keyof HopePlayerEventMap, EventListener]> = [];\n\nonMounted(() => {\n const el = elRef.value;\n if (!el) return;\n\n // Dinleyiciler import'u beklemeden eklenir: core yüklenince customElements.define() elementi senkron upgrade\n // edip hp:ready'yi .then()'den ÖNCE dispatch ediyor — beklenirse @ready kaçırılır.\n listeners = [\n ['hp:ready', () => emit('ready')],\n ['hp:play', () => emit('play')],\n ['hp:pause', () => emit('pause')],\n ['hp:ended', () => emit('ended')],\n ['hp:error', (e) => emit('error', (e as CustomEvent<{ message: string }>).detail.message)],\n ['hp:qualitychange', (e) => emit('qualitychange', (e as CustomEvent<{ label: string }>).detail.label)],\n ['hp:ratechange', (e) => emit('ratechange', (e as CustomEvent<{ rate: number }>).detail.rate)],\n ['hp:adstart', (e) => emit('adstart', (e as CustomEvent<{ type: 'preroll' | 'midroll' | 'postroll' }>).detail.type)],\n ['hp:adend', (e) => emit('adend', (e as CustomEvent<{ type: 'preroll' | 'midroll' | 'postroll' }>).detail.type)],\n ['hp:aderror', (e) => emit('aderror', (e as CustomEvent<{ message: string }>).detail.message)],\n [\n 'hp:itemchange',\n (e) => {\n const detail = (e as CustomEvent<{ index: number; source: 'playlist' | 'story' }>).detail;\n emit('itemchange', detail.index, detail.source);\n },\n ],\n [\n 'hp:sticky',\n (e) => {\n const detail = (e as CustomEvent<{ sticky: boolean; corner?: StickyCorner }>).detail;\n emit('sticky', detail.sticky, detail.corner);\n },\n ],\n ['hp:sourcefallback', (e) => emit('sourcefallback', (e as HopePlayerEventMap['hp:sourcefallback']).detail)],\n ];\n for (const [name, handler] of listeners) el.addEventListener(name, handler);\n\n // .options için import'u bekle: element upgrade olmadan yazmak prototip accessor'ını kalıcı olarak maskeler.\n import('@hopeplayer/core').then(() => {\n if (cancelled || !elRef.value) return;\n elRef.value.options = { ...props } as HopePlayerOptions;\n });\n});\n\n// Tüm prop'lar tek bir string olarak izlenir (prop başına ayrı watcher gerekmez).\nwatch(\n () => JSON.stringify(props),\n () => {\n if (elRef.value) elRef.value.options = { ...props } as HopePlayerOptions;\n }\n);\n\nonBeforeUnmount(() => {\n cancelled = true;\n const el = elRef.value;\n if (el) for (const [name, handler] of listeners) el.removeEventListener(name, handler);\n});\n\nfunction play(): Promise<void> {\n return elRef.value?.play() ?? Promise.resolve();\n}\n\nfunction pause(): void {\n elRef.value?.pause();\n}\n\nfunction getElement(): HopePlayerEl | null {\n return elRef.value;\n}\n\ndefineExpose({ play, pause, getElement });\n</script>\n\n<template>\n <hope-player ref=\"elRef\" />\n</template>\n"],"names":["props","__props","emit","__emit","elRef","ref","cancelled","listeners","onMounted","el","detail","name","handler","watch","onBeforeUnmount","play","_a","pause","getElement","__expose","_createElementBlock"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hope-player-vue.js","sources":["../src/HopePlayer.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// <hope-player> için ince Vue sarmalayıcı: prop'ları `.options`'a yazar, `hp:*` event'lerini emit'lere çevirir.\n// class/style Vue'nun fallthrough attribute'larıyla köke geçer. Core `onMounted` içinde dinamik import edilir —\n// statik import `HTMLElement` olmayan SSR'da (Nuxt) çöker.\nimport { ref, onMounted, onBeforeUnmount, watch } from 'vue';\nimport type { HopePlayerElement as HopePlayerEl, HopePlayerEventMap, HopePlayerOptions, StickyCorner } from '@hopeplayer/core';\n\nconst props = defineProps<HopePlayerOptions>();\n\nconst emit = defineEmits<{\n ready: [];\n play: [];\n pause: [];\n ended: [];\n error: [message: string];\n qualitychange: [label: string];\n ratechange: [rate: number];\n adstart: [type: 'preroll' | 'midroll' | 'postroll'];\n adend: [type: 'preroll' | 'midroll' | 'postroll'];\n aderror: [message: string];\n itemchange: [index: number, source: 'playlist' | 'story'];\n sticky: [sticky: boolean, corner: StickyCorner | undefined];\n sourcefallback: [detail: HopePlayerEventMap['hp:sourcefallback']['detail']];\n}>();\n\nconst elRef = ref<HopePlayerEl | null>(null);\nlet cancelled = false;\nlet listeners: Array<[keyof HopePlayerEventMap, EventListener]> = [];\n\nonMounted(() => {\n const el = elRef.value;\n if (!el) return;\n\n // Dinleyiciler import'u beklemeden eklenir: core yüklenince customElements.define() elementi senkron upgrade\n // edip hp:ready'yi .then()'den ÖNCE dispatch ediyor — beklenirse @ready kaçırılır.\n listeners = [\n ['hp:ready', () => emit('ready')],\n ['hp:play', () => emit('play')],\n ['hp:pause', () => emit('pause')],\n ['hp:ended', () => emit('ended')],\n ['hp:error', (e) => emit('error', (e as CustomEvent<{ message: string }>).detail.message)],\n ['hp:qualitychange', (e) => emit('qualitychange', (e as CustomEvent<{ label: string }>).detail.label)],\n ['hp:ratechange', (e) => emit('ratechange', (e as CustomEvent<{ rate: number }>).detail.rate)],\n ['hp:adstart', (e) => emit('adstart', (e as CustomEvent<{ type: 'preroll' | 'midroll' | 'postroll' }>).detail.type)],\n ['hp:adend', (e) => emit('adend', (e as CustomEvent<{ type: 'preroll' | 'midroll' | 'postroll' }>).detail.type)],\n ['hp:aderror', (e) => emit('aderror', (e as CustomEvent<{ message: string }>).detail.message)],\n [\n 'hp:itemchange',\n (e) => {\n const detail = (e as CustomEvent<{ index: number; source: 'playlist' | 'story' }>).detail;\n emit('itemchange', detail.index, detail.source);\n },\n ],\n [\n 'hp:sticky',\n (e) => {\n const detail = (e as CustomEvent<{ sticky: boolean; corner?: StickyCorner }>).detail;\n emit('sticky', detail.sticky, detail.corner);\n },\n ],\n ['hp:sourcefallback', (e) => emit('sourcefallback', (e as HopePlayerEventMap['hp:sourcefallback']).detail)],\n ];\n for (const [name, handler] of listeners) el.addEventListener(name, handler);\n\n // .options için import'u bekle: element upgrade olmadan yazmak prototip accessor'ını kalıcı olarak maskeler.\n import('@hopeplayer/core').then(() => {\n if (cancelled || !elRef.value) return;\n elRef.value.options = { ...props } as HopePlayerOptions;\n });\n});\n\n// Tüm prop'lar tek bir string olarak izlenir (prop başına ayrı watcher gerekmez).\nwatch(\n () => JSON.stringify(props),\n () => {\n if (elRef.value) elRef.value.options = { ...props } as HopePlayerOptions;\n }\n);\n\nonBeforeUnmount(() => {\n cancelled = true;\n const el = elRef.value;\n if (el) for (const [name, handler] of listeners) el.removeEventListener(name, handler);\n});\n\nfunction play(): Promise<void> {\n return elRef.value?.play() ?? Promise.resolve();\n}\n\nfunction pause(): void {\n elRef.value?.pause();\n}\n\nfunction getElement(): HopePlayerEl | null {\n return elRef.value;\n}\n\ndefineExpose({ play, pause, getElement });\n</script>\n\n<template>\n <hope-player ref=\"elRef\" />\n</template>\n"],"names":["props","__props","emit","__emit","elRef","ref","cancelled","listeners","onMounted","el","detail","name","handler","watch","onBeforeUnmount","play","_a","pause","getElement","__expose","_createElementBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAQC,GAERC,IAAOC,GAgBPC,IAAQC,EAAyB,IAAI;AAC3C,QAAIC,IAAY,IACZC,IAA8D,CAAA;AAElE,IAAAC,EAAU,MAAM;AACZ,YAAMC,IAAKL,EAAM;AACjB,UAAKK,GAIL;AAAA,QAAAF,IAAY;AAAA,UACR,CAAC,YAAY,MAAML,E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;AAAA;AAAA,IACL,CAAC,GAGDa;AAAA,MACI,MAAM,KAAK,UAAUb,CAAK;AAAA,MAC1B,MAAM;AACF,QAAII,EAAM,UAAOA,EAAM,MAAM,UAAU,EAAE,GAAGJ,EAAA;AAAA,MAChD;AAAA,IAAA,GAGJc,EAAgB,MAAM;AAClB,MAAAR,IAAY;AACZ,YAAMG,IAAKL,EAAM;AACjB,UAAIK,EAAI,YAAW,CAACE,GAAMC,CAAO,KAAKL,EAAW,CAAAE,EAAG,oBAAoBE,GAAMC,CAAO;AAAA,IACzF,CAAC;AAED,aAASG,IAAsB;;AAC3B,eAAOC,IAAAZ,EAAM,UAAN,gBAAAY,EAAa,WAAU,QAAQ,QAAA;AAAA,IAC1C;AAEA,aAASC,IAAc;;AACnB,OAAAD,IAAAZ,EAAM,UAAN,QAAAY,EAAa;AAAA,IACjB;AAEA,aAASE,IAAkC;AACvC,aAAOd,EAAM;AAAA,IACjB;AAEA,WAAAe,EAAa,EAAE,MAAAJ,GAAM,OAAAE,GAAO,YAAAC,EAAA,CAAY,mBAIpCE,EAA2B,eAAA;AAAA,eAAV;AAAA,MAAJ,KAAIhB;AAAA,IAAA;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hopeplayer/vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Thin Vue 3 wrapper around <hope-player> (@hopeplayer/core) — prop/event bridge only, no state duplication",
|
|
5
5
|
"keywords": ["vue", "vue3", "nuxt", "vue-component", "video-player", "video", "player", "html5-video", "hls", "m3u8", "web-component", "custom-element", "ima", "vast", "vmap", "prebid", "ads", "monetization", "chromecast", "airplay", "subtitles", "shadow-dom", "hopeplayer"],
|
|
6
6
|
"repository": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"typecheck": "vue-tsc -p tsconfig.json --noEmit"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@hopeplayer/core": "^1.
|
|
38
|
+
"@hopeplayer/core": "^1.2.0",
|
|
39
39
|
"vue": ">=3.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@hopeplayer/core": "^1.
|
|
42
|
+
"@hopeplayer/core": "^1.2.0",
|
|
43
43
|
"@vitejs/plugin-vue": "^6.0.0",
|
|
44
44
|
"typescript": "^5.7.0",
|
|
45
45
|
"vite": "^6.0.0",
|