@viostream/viostream-player-vue 0.2.6 → 0.2.8
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 +1 -19
- package/dist/ViostreamPlayer.vue.d.ts +2 -0
- package/dist/ViostreamPlayer.vue.d.ts.map +1 -1
- package/dist/index.js +402 -64
- package/dist/version.d.ts +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -91,6 +91,7 @@ All embed options are optional and passed directly to the Viostream embed API.
|
|
|
91
91
|
| `start-time` | `string` | Seek to a time (seconds) before playback. |
|
|
92
92
|
| `transcript-download` | `boolean` | Allow transcript download. Default: `false`. |
|
|
93
93
|
| `use-settings-menu` | `boolean` | Enable the settings menu on the control bar. Default: `false`. |
|
|
94
|
+
| `force-aspect-ratio` | `number` | Force a specific aspect ratio (e.g. `1.7778` for 16:9). Disables dynamic sizing. Must be a finite positive number; invalid values are ignored. |
|
|
94
95
|
|
|
95
96
|
#### Events
|
|
96
97
|
|
|
@@ -292,25 +293,6 @@ After calling `destroy()`:
|
|
|
292
293
|
- Getter calls will reject with `"Player has been destroyed"`.
|
|
293
294
|
---
|
|
294
295
|
|
|
295
|
-
## Script Loader
|
|
296
|
-
|
|
297
|
-
The SDK loads the Viostream API script automatically. If you need manual control over loading (e.g. preloading), you can use `loadViostream` directly:
|
|
298
|
-
|
|
299
|
-
```ts
|
|
300
|
-
import { loadViostream } from '@viostream/viostream-player-vue';
|
|
301
|
-
|
|
302
|
-
const api = await loadViostream('vc-100100100');
|
|
303
|
-
// api.embed(...) is now available
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
The loader:
|
|
307
|
-
- Injects `<script src="https://play.viostream.com/api/{accountKey}">` into `<head>`.
|
|
308
|
-
- Deduplicates requests -- calling it multiple times with the same key returns the same promise.
|
|
309
|
-
- Times out after 15 seconds if the script fails to load.
|
|
310
|
-
- Detects if the script tag already exists in the DOM (e.g. added manually) and waits for it.
|
|
311
|
-
|
|
312
|
-
---
|
|
313
|
-
|
|
314
296
|
## TypeScript
|
|
315
297
|
|
|
316
298
|
Every export is fully typed. Import types alongside runtime exports:
|
|
@@ -18,6 +18,7 @@ type __VLS_Props = {
|
|
|
18
18
|
startTime?: string;
|
|
19
19
|
transcriptDownload?: boolean;
|
|
20
20
|
useSettingsMenu?: boolean;
|
|
21
|
+
forceAspectRatio?: number;
|
|
21
22
|
class?: string;
|
|
22
23
|
};
|
|
23
24
|
declare function __VLS_template(): {
|
|
@@ -80,6 +81,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
80
81
|
startTime: string;
|
|
81
82
|
transcriptDownload: boolean;
|
|
82
83
|
useSettingsMenu: boolean;
|
|
84
|
+
forceAspectRatio: number;
|
|
83
85
|
class: string;
|
|
84
86
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
85
87
|
containerRef: HTMLDivElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViostreamPlayer.vue.d.ts","sourceRoot":"","sources":["../src/ViostreamPlayer.vue"],"names":[],"mappings":"AAMA;
|
|
1
|
+
{"version":3,"file":"ViostreamPlayer.vue.d.ts","sourceRoot":"","sources":["../src/ViostreamPlayer.vue"],"names":[],"mappings":"AAMA;AA4RA,OAAO,KAAK,EAEV,eAAe,EAGf,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,kCAAkC,CAAC;AAS1C,KAAK,WAAW,GAAG;IAEjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,CAAC;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAmOF,iBAAS,cAAc;WAwCT,OAAO,IAA6B;;kBA7NtC,MAAM,OAAO;gBACf,CAAC,KAAK,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;kBADrC,MAAM,OAAO;gBACf,CAAC,KAAK,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;;;;;EAiOhD;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;cArTR,OAAO;iBACJ,MAAM;kBACL,OAAO;wBACD,OAAO;eAChB,MAAM;iBACJ,OAAO,GAAG,OAAO,GAAG,cAAc;aACtC,OAAO;gBACJ,MAAM;oBACF,MAAM;gBACV,OAAO;kBACL,MAAM;mBACL,OAAO;sBACJ,MAAM;eACb,MAAM;wBACG,OAAO;qBACV,OAAO;sBACN,MAAM;WAGjB,MAAM;;;kBA4Sd,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,330 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { getViostreamApi as
|
|
3
|
-
import { createViostreamPlayer as
|
|
4
|
-
|
|
1
|
+
import { defineComponent as O, ref as S, onMounted as V, onUnmounted as j, openBlock as U, createElementBlock as x, unref as M, normalizeClass as L, renderSlot as B, createCommentVNode as R, createElementVNode as q, toDisplayString as z } from "vue";
|
|
2
|
+
import { getViostreamApi as Q, normalizeForceAspectRatio as J, wrapRawPlayer as G } from "@viostream/viostream-player-core";
|
|
3
|
+
import { createViostreamPlayer as ce, loadViostream as ue } from "@viostream/viostream-player-core";
|
|
4
|
+
function W(c) {
|
|
5
|
+
return c && c.__esModule && Object.prototype.hasOwnProperty.call(c, "default") ? c.default : c;
|
|
6
|
+
}
|
|
7
|
+
var K = { exports: {} }, E, T;
|
|
8
|
+
function Z() {
|
|
9
|
+
if (T) return E;
|
|
10
|
+
T = 1;
|
|
11
|
+
var c = 1e3, l = c * 60, i = l * 60, e = i * 24, d = e * 7, m = e * 365.25;
|
|
12
|
+
E = function(o, t) {
|
|
13
|
+
t = t || {};
|
|
14
|
+
var n = typeof o;
|
|
15
|
+
if (n === "string" && o.length > 0)
|
|
16
|
+
return h(o);
|
|
17
|
+
if (n === "number" && isFinite(o))
|
|
18
|
+
return t.long ? s(o) : v(o);
|
|
19
|
+
throw new Error(
|
|
20
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(o)
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
function h(o) {
|
|
24
|
+
if (o = String(o), !(o.length > 100)) {
|
|
25
|
+
var t = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
26
|
+
o
|
|
27
|
+
);
|
|
28
|
+
if (t) {
|
|
29
|
+
var n = parseFloat(t[1]), a = (t[2] || "ms").toLowerCase();
|
|
30
|
+
switch (a) {
|
|
31
|
+
case "years":
|
|
32
|
+
case "year":
|
|
33
|
+
case "yrs":
|
|
34
|
+
case "yr":
|
|
35
|
+
case "y":
|
|
36
|
+
return n * m;
|
|
37
|
+
case "weeks":
|
|
38
|
+
case "week":
|
|
39
|
+
case "w":
|
|
40
|
+
return n * d;
|
|
41
|
+
case "days":
|
|
42
|
+
case "day":
|
|
43
|
+
case "d":
|
|
44
|
+
return n * e;
|
|
45
|
+
case "hours":
|
|
46
|
+
case "hour":
|
|
47
|
+
case "hrs":
|
|
48
|
+
case "hr":
|
|
49
|
+
case "h":
|
|
50
|
+
return n * i;
|
|
51
|
+
case "minutes":
|
|
52
|
+
case "minute":
|
|
53
|
+
case "mins":
|
|
54
|
+
case "min":
|
|
55
|
+
case "m":
|
|
56
|
+
return n * l;
|
|
57
|
+
case "seconds":
|
|
58
|
+
case "second":
|
|
59
|
+
case "secs":
|
|
60
|
+
case "sec":
|
|
61
|
+
case "s":
|
|
62
|
+
return n * c;
|
|
63
|
+
case "milliseconds":
|
|
64
|
+
case "millisecond":
|
|
65
|
+
case "msecs":
|
|
66
|
+
case "msec":
|
|
67
|
+
case "ms":
|
|
68
|
+
return n;
|
|
69
|
+
default:
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function v(o) {
|
|
76
|
+
var t = Math.abs(o);
|
|
77
|
+
return t >= e ? Math.round(o / e) + "d" : t >= i ? Math.round(o / i) + "h" : t >= l ? Math.round(o / l) + "m" : t >= c ? Math.round(o / c) + "s" : o + "ms";
|
|
78
|
+
}
|
|
79
|
+
function s(o) {
|
|
80
|
+
var t = Math.abs(o);
|
|
81
|
+
return t >= e ? f(o, t, e, "day") : t >= i ? f(o, t, i, "hour") : t >= l ? f(o, t, l, "minute") : t >= c ? f(o, t, c, "second") : o + " ms";
|
|
82
|
+
}
|
|
83
|
+
function f(o, t, n, a) {
|
|
84
|
+
var u = t >= n * 1.5;
|
|
85
|
+
return Math.round(o / n) + " " + a + (u ? "s" : "");
|
|
86
|
+
}
|
|
87
|
+
return E;
|
|
88
|
+
}
|
|
89
|
+
var A, _;
|
|
90
|
+
function H() {
|
|
91
|
+
if (_) return A;
|
|
92
|
+
_ = 1;
|
|
93
|
+
function c(l) {
|
|
94
|
+
e.debug = e, e.default = e, e.coerce = f, e.disable = v, e.enable = m, e.enabled = s, e.humanize = Z(), e.destroy = o, Object.keys(l).forEach((t) => {
|
|
95
|
+
e[t] = l[t];
|
|
96
|
+
}), e.names = [], e.skips = [], e.formatters = {};
|
|
97
|
+
function i(t) {
|
|
98
|
+
let n = 0;
|
|
99
|
+
for (let a = 0; a < t.length; a++)
|
|
100
|
+
n = (n << 5) - n + t.charCodeAt(a), n |= 0;
|
|
101
|
+
return e.colors[Math.abs(n) % e.colors.length];
|
|
102
|
+
}
|
|
103
|
+
e.selectColor = i;
|
|
104
|
+
function e(t) {
|
|
105
|
+
let n, a = null, u, b;
|
|
106
|
+
function p(...y) {
|
|
107
|
+
if (!p.enabled)
|
|
108
|
+
return;
|
|
109
|
+
const r = p, C = Number(/* @__PURE__ */ new Date()), F = C - (n || C);
|
|
110
|
+
r.diff = F, r.prev = n, r.curr = C, n = C, y[0] = e.coerce(y[0]), typeof y[0] != "string" && y.unshift("%O");
|
|
111
|
+
let g = 0;
|
|
112
|
+
y[0] = y[0].replace(/%([a-zA-Z%])/g, (w, D) => {
|
|
113
|
+
if (w === "%%")
|
|
114
|
+
return "%";
|
|
115
|
+
g++;
|
|
116
|
+
const I = e.formatters[D];
|
|
117
|
+
if (typeof I == "function") {
|
|
118
|
+
const N = y[g];
|
|
119
|
+
w = I.call(r, N), y.splice(g, 1), g--;
|
|
120
|
+
}
|
|
121
|
+
return w;
|
|
122
|
+
}), e.formatArgs.call(r, y), (r.log || e.log).apply(r, y);
|
|
123
|
+
}
|
|
124
|
+
return p.namespace = t, p.useColors = e.useColors(), p.color = e.selectColor(t), p.extend = d, p.destroy = e.destroy, Object.defineProperty(p, "enabled", {
|
|
125
|
+
enumerable: !0,
|
|
126
|
+
configurable: !1,
|
|
127
|
+
get: () => a !== null ? a : (u !== e.namespaces && (u = e.namespaces, b = e.enabled(t)), b),
|
|
128
|
+
set: (y) => {
|
|
129
|
+
a = y;
|
|
130
|
+
}
|
|
131
|
+
}), typeof e.init == "function" && e.init(p), p;
|
|
132
|
+
}
|
|
133
|
+
function d(t, n) {
|
|
134
|
+
const a = e(this.namespace + (typeof n > "u" ? ":" : n) + t);
|
|
135
|
+
return a.log = this.log, a;
|
|
136
|
+
}
|
|
137
|
+
function m(t) {
|
|
138
|
+
e.save(t), e.namespaces = t, e.names = [], e.skips = [];
|
|
139
|
+
const n = (typeof t == "string" ? t : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
140
|
+
for (const a of n)
|
|
141
|
+
a[0] === "-" ? e.skips.push(a.slice(1)) : e.names.push(a);
|
|
142
|
+
}
|
|
143
|
+
function h(t, n) {
|
|
144
|
+
let a = 0, u = 0, b = -1, p = 0;
|
|
145
|
+
for (; a < t.length; )
|
|
146
|
+
if (u < n.length && (n[u] === t[a] || n[u] === "*"))
|
|
147
|
+
n[u] === "*" ? (b = u, p = a, u++) : (a++, u++);
|
|
148
|
+
else if (b !== -1)
|
|
149
|
+
u = b + 1, p++, a = p;
|
|
150
|
+
else
|
|
151
|
+
return !1;
|
|
152
|
+
for (; u < n.length && n[u] === "*"; )
|
|
153
|
+
u++;
|
|
154
|
+
return u === n.length;
|
|
155
|
+
}
|
|
156
|
+
function v() {
|
|
157
|
+
const t = [
|
|
158
|
+
...e.names,
|
|
159
|
+
...e.skips.map((n) => "-" + n)
|
|
160
|
+
].join(",");
|
|
161
|
+
return e.enable(""), t;
|
|
162
|
+
}
|
|
163
|
+
function s(t) {
|
|
164
|
+
for (const n of e.skips)
|
|
165
|
+
if (h(t, n))
|
|
166
|
+
return !1;
|
|
167
|
+
for (const n of e.names)
|
|
168
|
+
if (h(t, n))
|
|
169
|
+
return !0;
|
|
170
|
+
return !1;
|
|
171
|
+
}
|
|
172
|
+
function f(t) {
|
|
173
|
+
return t instanceof Error ? t.stack || t.message : t;
|
|
174
|
+
}
|
|
175
|
+
function o() {
|
|
176
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
177
|
+
}
|
|
178
|
+
return e.enable(e.load()), e;
|
|
179
|
+
}
|
|
180
|
+
return A = c, A;
|
|
181
|
+
}
|
|
182
|
+
var P;
|
|
183
|
+
function X() {
|
|
184
|
+
return P || (P = 1, (function(c, l) {
|
|
185
|
+
l.formatArgs = e, l.save = d, l.load = m, l.useColors = i, l.storage = h(), l.destroy = /* @__PURE__ */ (() => {
|
|
186
|
+
let s = !1;
|
|
187
|
+
return () => {
|
|
188
|
+
s || (s = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
|
|
189
|
+
};
|
|
190
|
+
})(), l.colors = [
|
|
191
|
+
"#0000CC",
|
|
192
|
+
"#0000FF",
|
|
193
|
+
"#0033CC",
|
|
194
|
+
"#0033FF",
|
|
195
|
+
"#0066CC",
|
|
196
|
+
"#0066FF",
|
|
197
|
+
"#0099CC",
|
|
198
|
+
"#0099FF",
|
|
199
|
+
"#00CC00",
|
|
200
|
+
"#00CC33",
|
|
201
|
+
"#00CC66",
|
|
202
|
+
"#00CC99",
|
|
203
|
+
"#00CCCC",
|
|
204
|
+
"#00CCFF",
|
|
205
|
+
"#3300CC",
|
|
206
|
+
"#3300FF",
|
|
207
|
+
"#3333CC",
|
|
208
|
+
"#3333FF",
|
|
209
|
+
"#3366CC",
|
|
210
|
+
"#3366FF",
|
|
211
|
+
"#3399CC",
|
|
212
|
+
"#3399FF",
|
|
213
|
+
"#33CC00",
|
|
214
|
+
"#33CC33",
|
|
215
|
+
"#33CC66",
|
|
216
|
+
"#33CC99",
|
|
217
|
+
"#33CCCC",
|
|
218
|
+
"#33CCFF",
|
|
219
|
+
"#6600CC",
|
|
220
|
+
"#6600FF",
|
|
221
|
+
"#6633CC",
|
|
222
|
+
"#6633FF",
|
|
223
|
+
"#66CC00",
|
|
224
|
+
"#66CC33",
|
|
225
|
+
"#9900CC",
|
|
226
|
+
"#9900FF",
|
|
227
|
+
"#9933CC",
|
|
228
|
+
"#9933FF",
|
|
229
|
+
"#99CC00",
|
|
230
|
+
"#99CC33",
|
|
231
|
+
"#CC0000",
|
|
232
|
+
"#CC0033",
|
|
233
|
+
"#CC0066",
|
|
234
|
+
"#CC0099",
|
|
235
|
+
"#CC00CC",
|
|
236
|
+
"#CC00FF",
|
|
237
|
+
"#CC3300",
|
|
238
|
+
"#CC3333",
|
|
239
|
+
"#CC3366",
|
|
240
|
+
"#CC3399",
|
|
241
|
+
"#CC33CC",
|
|
242
|
+
"#CC33FF",
|
|
243
|
+
"#CC6600",
|
|
244
|
+
"#CC6633",
|
|
245
|
+
"#CC9900",
|
|
246
|
+
"#CC9933",
|
|
247
|
+
"#CCCC00",
|
|
248
|
+
"#CCCC33",
|
|
249
|
+
"#FF0000",
|
|
250
|
+
"#FF0033",
|
|
251
|
+
"#FF0066",
|
|
252
|
+
"#FF0099",
|
|
253
|
+
"#FF00CC",
|
|
254
|
+
"#FF00FF",
|
|
255
|
+
"#FF3300",
|
|
256
|
+
"#FF3333",
|
|
257
|
+
"#FF3366",
|
|
258
|
+
"#FF3399",
|
|
259
|
+
"#FF33CC",
|
|
260
|
+
"#FF33FF",
|
|
261
|
+
"#FF6600",
|
|
262
|
+
"#FF6633",
|
|
263
|
+
"#FF9900",
|
|
264
|
+
"#FF9933",
|
|
265
|
+
"#FFCC00",
|
|
266
|
+
"#FFCC33"
|
|
267
|
+
];
|
|
268
|
+
function i() {
|
|
269
|
+
if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs))
|
|
270
|
+
return !0;
|
|
271
|
+
if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))
|
|
272
|
+
return !1;
|
|
273
|
+
let s;
|
|
274
|
+
return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
275
|
+
typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
276
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
277
|
+
typeof navigator < "u" && navigator.userAgent && (s = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(s[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
278
|
+
typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
279
|
+
}
|
|
280
|
+
function e(s) {
|
|
281
|
+
if (s[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + s[0] + (this.useColors ? "%c " : " ") + "+" + c.exports.humanize(this.diff), !this.useColors)
|
|
282
|
+
return;
|
|
283
|
+
const f = "color: " + this.color;
|
|
284
|
+
s.splice(1, 0, f, "color: inherit");
|
|
285
|
+
let o = 0, t = 0;
|
|
286
|
+
s[0].replace(/%[a-zA-Z%]/g, (n) => {
|
|
287
|
+
n !== "%%" && (o++, n === "%c" && (t = o));
|
|
288
|
+
}), s.splice(t, 0, f);
|
|
289
|
+
}
|
|
290
|
+
l.log = console.debug || console.log || (() => {
|
|
291
|
+
});
|
|
292
|
+
function d(s) {
|
|
293
|
+
try {
|
|
294
|
+
s ? l.storage.setItem("debug", s) : l.storage.removeItem("debug");
|
|
295
|
+
} catch {
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function m() {
|
|
299
|
+
let s;
|
|
300
|
+
try {
|
|
301
|
+
s = l.storage.getItem("debug") || l.storage.getItem("DEBUG");
|
|
302
|
+
} catch {
|
|
303
|
+
}
|
|
304
|
+
return !s && typeof process < "u" && "env" in process && (s = process.env.DEBUG), s;
|
|
305
|
+
}
|
|
306
|
+
function h() {
|
|
307
|
+
try {
|
|
308
|
+
return localStorage;
|
|
309
|
+
} catch {
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
c.exports = H()(l);
|
|
313
|
+
const { formatters: v } = c.exports;
|
|
314
|
+
v.j = function(s) {
|
|
315
|
+
try {
|
|
316
|
+
return JSON.stringify(s);
|
|
317
|
+
} catch (f) {
|
|
318
|
+
return "[UnexpectedJSONParseError]: " + f.message;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
})(K, K.exports)), K.exports;
|
|
322
|
+
}
|
|
323
|
+
var Y = X();
|
|
324
|
+
const $ = /* @__PURE__ */ W(Y), ee = "viostream-player-vue", te = "0.2.8", re = ["data-viostream-public-key", "data-viostream-sdk"], ne = {
|
|
5
325
|
"data-viostream-error": "",
|
|
6
326
|
style: { color: "red", padding: "1em" }
|
|
7
|
-
},
|
|
327
|
+
}, ie = /* @__PURE__ */ O({
|
|
8
328
|
__name: "ViostreamPlayer",
|
|
9
329
|
props: {
|
|
10
330
|
accountKey: {},
|
|
@@ -25,29 +345,31 @@ const I = "viostream-player-vue", U = "0.2.6", $ = ["data-viostream-public-key",
|
|
|
25
345
|
startTime: { default: void 0 },
|
|
26
346
|
transcriptDownload: { type: Boolean, default: void 0 },
|
|
27
347
|
useSettingsMenu: { type: Boolean, default: void 0 },
|
|
348
|
+
forceAspectRatio: { default: void 0 },
|
|
28
349
|
class: { default: void 0 }
|
|
29
350
|
},
|
|
30
351
|
emits: ["play", "pause", "ended", "timeUpdate", "volumeChange", "error", "progress", "ready", "seeked", "loaded", "playerReady"],
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
33
|
-
let
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
["
|
|
42
|
-
["
|
|
43
|
-
["
|
|
44
|
-
["
|
|
45
|
-
["
|
|
46
|
-
["
|
|
47
|
-
["
|
|
48
|
-
["
|
|
49
|
-
["
|
|
50
|
-
|
|
352
|
+
setup(c, { emit: l }) {
|
|
353
|
+
const i = $("viostream:vue"), e = c, d = l, m = `viostream-player-${Math.random().toString(36).slice(2, 10)}`, h = S(), v = S(), s = S(), f = S(!0);
|
|
354
|
+
let o = !1;
|
|
355
|
+
const t = [];
|
|
356
|
+
i("component setup publicKey=%s containerId=%s", e.publicKey, m);
|
|
357
|
+
function n() {
|
|
358
|
+
const r = {};
|
|
359
|
+
return e.chapters !== void 0 && (r.chapters = e.chapters), e.chapterSlug !== void 0 && (r.chapterSlug = e.chapterSlug), e.displayTitle !== void 0 && (r.displayTitle = e.displayTitle), e.hlsQualitySelector !== void 0 && (r.hlsQualitySelector = e.hlsQualitySelector), e.playerKey !== void 0 && (r.playerKey = e.playerKey), e.playerStyle !== void 0 && (r.playerStyle = e.playerStyle), e.sharing !== void 0 && (r.sharing = e.sharing), e.skinActive !== void 0 && (r.skinActive = e.skinActive), e.skinBackground !== void 0 && (r.skinBackground = e.skinBackground), e.skinCustom !== void 0 && (r.skinCustom = e.skinCustom), e.skinInactive !== void 0 && (r.skinInactive = e.skinInactive), e.speedSelector !== void 0 && (r.speedSelector = e.speedSelector), e.startEndTimespan !== void 0 && (r.startEndTimespan = e.startEndTimespan), e.startTime !== void 0 && (r.startTime = e.startTime), e.transcriptDownload !== void 0 && (r.transcriptDownload = e.transcriptDownload), e.useSettingsMenu !== void 0 && (r.useSettingsMenu = e.useSettingsMenu), r;
|
|
360
|
+
}
|
|
361
|
+
const a = [
|
|
362
|
+
["play", () => d("play")],
|
|
363
|
+
["pause", () => d("pause")],
|
|
364
|
+
["ended", () => d("ended")],
|
|
365
|
+
["timeUpdate", (r) => d("timeUpdate", r)],
|
|
366
|
+
["volumeChange", (r) => d("volumeChange", r)],
|
|
367
|
+
["error", (r) => d("error", r)],
|
|
368
|
+
["progress", (r) => d("progress", r)],
|
|
369
|
+
["ready", () => d("ready")],
|
|
370
|
+
["seeked", () => d("seeked")],
|
|
371
|
+
["loaded", () => d("loaded")]
|
|
372
|
+
], u = {
|
|
51
373
|
play: "play",
|
|
52
374
|
pause: "pause",
|
|
53
375
|
ended: "ended",
|
|
@@ -59,60 +381,76 @@ const I = "viostream-player-vue", U = "0.2.6", $ = ["data-viostream-public-key",
|
|
|
59
381
|
seeked: "seeked",
|
|
60
382
|
loaded: "loaded"
|
|
61
383
|
};
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
384
|
+
function b(r) {
|
|
385
|
+
const C = [];
|
|
386
|
+
for (const [F, g] of a) {
|
|
387
|
+
const k = u[F];
|
|
388
|
+
if (k) {
|
|
389
|
+
const w = r.on(k, g);
|
|
390
|
+
t.push(w), C.push(k);
|
|
68
391
|
}
|
|
69
392
|
}
|
|
393
|
+
i("wireEvents: subscribed to [%s]", C.join(", "));
|
|
70
394
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
395
|
+
function p() {
|
|
396
|
+
i("unwireEvents: unsubscribing %d events", t.length);
|
|
397
|
+
for (const r of t)
|
|
398
|
+
r();
|
|
399
|
+
t.length = 0;
|
|
75
400
|
}
|
|
76
|
-
async function
|
|
401
|
+
async function y() {
|
|
77
402
|
try {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
o.destroy();
|
|
403
|
+
i("init: getting embed API");
|
|
404
|
+
const r = Q();
|
|
405
|
+
if (o) {
|
|
406
|
+
i("init: stale closure detected after getViostreamApi — aborting publicKey=%s", e.publicKey);
|
|
83
407
|
return;
|
|
84
408
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
409
|
+
const C = n();
|
|
410
|
+
i("init: calling api.embed publicKey=%s containerId=%s options=%o", e.publicKey, m, C);
|
|
411
|
+
const F = r.embed(e.publicKey, m, C, J(e.forceAspectRatio));
|
|
412
|
+
i("init: api.embed returned raw player");
|
|
413
|
+
const g = G(F, m);
|
|
414
|
+
if (i("init: wrapRawPlayer completed containerId=%s", m), o) {
|
|
415
|
+
i("init: stale closure detected after wrapRawPlayer — destroying and aborting publicKey=%s", e.publicKey), g.destroy();
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
v.value = g, f.value = !1, i("init: player set, isLoading -> false publicKey=%s", e.publicKey), b(g), i("init: emitting playerReady publicKey=%s", e.publicKey), d("playerReady", g);
|
|
419
|
+
} catch (r) {
|
|
420
|
+
if (o)
|
|
421
|
+
i("init: error caught but destroyed — ignoring publicKey=%s", e.publicKey);
|
|
422
|
+
else {
|
|
423
|
+
const C = r instanceof Error ? r.message : String(r);
|
|
424
|
+
i("init: error caught publicKey=%s error=%s", e.publicKey, C), s.value = C, f.value = !1;
|
|
425
|
+
}
|
|
88
426
|
}
|
|
89
427
|
}
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
}),
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
}), (
|
|
96
|
-
id:
|
|
97
|
-
class:
|
|
428
|
+
return V(() => {
|
|
429
|
+
i("onMounted publicKey=%s accountKey=%s containerId=%s", e.publicKey, e.accountKey, m), y();
|
|
430
|
+
}), j(() => {
|
|
431
|
+
var r;
|
|
432
|
+
i("onUnmounted publicKey=%s hasPlayer=%s", e.publicKey, !!v.value), o = !0, p(), (r = v.value) == null || r.destroy(), v.value = void 0;
|
|
433
|
+
}), (r, C) => (U(), x("div", {
|
|
434
|
+
id: m,
|
|
435
|
+
class: L(e.class),
|
|
98
436
|
ref_key: "containerRef",
|
|
99
|
-
ref:
|
|
437
|
+
ref: h,
|
|
100
438
|
"data-viostream-player": "",
|
|
101
|
-
"data-viostream-public-key":
|
|
102
|
-
"data-viostream-sdk": `${
|
|
439
|
+
"data-viostream-public-key": c.publicKey,
|
|
440
|
+
"data-viostream-sdk": `${M(ee)}@${M(te)}`
|
|
103
441
|
}, [
|
|
104
|
-
|
|
105
|
-
|
|
442
|
+
f.value ? B(r.$slots, "loading", { key: 0 }) : R("", !0),
|
|
443
|
+
s.value ? B(r.$slots, "error", {
|
|
106
444
|
key: 1,
|
|
107
|
-
message:
|
|
445
|
+
message: s.value
|
|
108
446
|
}, () => [
|
|
109
|
-
|
|
110
|
-
]) :
|
|
111
|
-
], 10,
|
|
447
|
+
q("div", ne, " Failed to load Viostream player: " + z(s.value), 1)
|
|
448
|
+
]) : R("", !0)
|
|
449
|
+
], 10, re));
|
|
112
450
|
}
|
|
113
451
|
});
|
|
114
452
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
453
|
+
ie as ViostreamPlayer,
|
|
454
|
+
ce as createViostreamPlayer,
|
|
455
|
+
ue as loadViostream
|
|
118
456
|
};
|
package/dist/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viostream/viostream-player-vue",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Vue 3 SDK for the Viostream video player — embed, control, and listen to player events",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"!dist/**/*.spec.*"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@viostream/viostream-player-core": "^0.2.
|
|
32
|
+
"@viostream/viostream-player-core": "^0.2.8",
|
|
33
|
+
"debug": "^4.4.3"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"vue": "^3.3.0"
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@testing-library/jest-dom": "^6.9.1",
|
|
39
40
|
"@testing-library/vue": "^8.1.0",
|
|
41
|
+
"@types/debug": "^4.1.13",
|
|
40
42
|
"@vitejs/plugin-vue": "^5.2.0",
|
|
41
43
|
"jsdom": "^28.1.0",
|
|
42
44
|
"typescript": "^5.7.0",
|
|
@@ -55,4 +57,4 @@
|
|
|
55
57
|
"embed",
|
|
56
58
|
"sdk"
|
|
57
59
|
]
|
|
58
|
-
}
|
|
60
|
+
}
|