@vindral/web-sdk 4.5.1 → 4.6.0-11-g50f93209
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/{C3YYzwmQ.js → B9ciBETj.js} +3750 -3092
- package/BZhOPJKq.js +154 -0
- package/BdMchGeH.js +169 -0
- package/{BdFcdkj1.js → BlnnMVOY.js} +26 -22
- package/{D7vM_Gpt.js → Bmh5ZR37.js} +12 -12
- package/{DeYmk5AL.js → Btob1dQR.js} +1 -1
- package/C6y28igI.js +101 -0
- package/{ci2nH0xq.js → CAFq7JeS.js} +1506 -1465
- package/CEhUHEp2.js +123 -0
- package/{BRKrFfT9.js → CXR7H5F_.js} +45 -22
- package/{C2-H3s2r.js → CcCOP7K4.js} +299 -298
- package/{BsJtUY1Z.js → DMGwVGGt.js} +2 -2
- package/{B7hT-BKr.js → DSw1XhvD.js} +1 -6
- package/DugdsSO5.js +7 -0
- package/api-client.js +1 -1
- package/cast-sender.d.ts +50 -3
- package/cast-sender.js +1 -1
- package/core.d.ts +141 -7
- package/core.js +3 -3
- package/legacy.d.ts +151 -7
- package/legacy.es.js +4580 -3721
- package/legacy.umd.js +172 -85
- package/package.json +1 -1
- package/player.d.ts +106 -8
- package/player.js +3 -3
- package/react.d.ts +106 -8
- package/vindral-player-component.js +2 -2
- package/Bt-ONXfO.js +0 -59
- package/C01DcfYu.js +0 -118
- package/Cug44nXk.js +0 -149
- package/FYiEDBC4.js +0 -50
- /package/{Ddby8xU_.js → Ct8GqCxq.js} +0 -0
- /package/{RxoWWyzp.js → DXFoVWQM.js} +0 -0
package/BZhOPJKq.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { n as e, t } from "./BsfwXDui.js";
|
|
2
|
+
import { t as n } from "./DrWNJwZx.js";
|
|
3
|
+
import { i as r, n as i, t as a } from "./BdMchGeH.js";
|
|
4
|
+
import { t as o } from "./DXFoVWQM.js";
|
|
5
|
+
//#region ../../libs/web-sdk/src/decoders/WebCodecsAudioDecoderContext.ts
|
|
6
|
+
var s, c = globalThis, l = (e) => {
|
|
7
|
+
var t, n;
|
|
8
|
+
if (!e) return {
|
|
9
|
+
description: e,
|
|
10
|
+
preSkip: 0
|
|
11
|
+
};
|
|
12
|
+
let r = e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
13
|
+
if (!(r.byteLength >= 19 && new TextDecoder().decode(r.subarray(0, 8)) === "OpusHead")) return {
|
|
14
|
+
description: e,
|
|
15
|
+
preSkip: 0
|
|
16
|
+
};
|
|
17
|
+
let i = r.slice();
|
|
18
|
+
return i[10] = 0, i[11] = 0, {
|
|
19
|
+
description: i,
|
|
20
|
+
preSkip: ((t = r[10]) == null ? 0 : t) | ((n = r[11]) == null ? 0 : n) << 8
|
|
21
|
+
};
|
|
22
|
+
}, u = class {
|
|
23
|
+
constructor(s) {
|
|
24
|
+
var c = this;
|
|
25
|
+
e(this, "decodedSamples", []), e(this, "decoder", null), e(this, "logger", void 0), e(this, "initSegments", /* @__PURE__ */ new Map()), e(this, "previousSample", void 0), e(this, "previousCodec", void 0), e(this, "pendingSamples", new n(Infinity)), e(this, "priming", { remaining: 0 }), e(this, "sentCount", 0), e(this, "doneCount", 0), e(this, "errors", new n(10)), e(this, "resetDecoderState", () => {
|
|
26
|
+
this.pendingSamples.clear(), this.doneCount = this.sentCount, this.previousSample = void 0, this.previousCodec = void 0;
|
|
27
|
+
}), e(this, "dropUndecoded", (e) => {
|
|
28
|
+
for (; this.doneCount < e && this.pendingSamples.pop();) this.doneCount++;
|
|
29
|
+
}), e(this, "ensureDecoder", () => ((!this.decoder || this.decoder.state === "closed") && (this.decoder = this.createDecoder()), this.decoder)), e(this, "createDecoder", () => new AudioDecoder({
|
|
30
|
+
output: (e) => {
|
|
31
|
+
let t = this.pendingSamples.pop();
|
|
32
|
+
if (!t) {
|
|
33
|
+
e.close();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.doneCount++;
|
|
37
|
+
let { sample: n, decodeStartTime: r, priming: i } = t;
|
|
38
|
+
try {
|
|
39
|
+
let t = e.numberOfFrames, a = e.numberOfChannels, s = e.sampleRate, c = e.duration, l = Math.min(t, Math.round(i.remaining * s / 48e3));
|
|
40
|
+
if (i.remaining = Math.max(0, i.remaining - Math.round(l * 48e3 / s)), l === t && t > 0) return;
|
|
41
|
+
let u = new Float32Array((t - l) * a);
|
|
42
|
+
e.copyTo(u, {
|
|
43
|
+
planeIndex: 0,
|
|
44
|
+
format: "f32",
|
|
45
|
+
frameOffset: l
|
|
46
|
+
});
|
|
47
|
+
let d = l > 0 ? Math.round((t - l) * n.timescale / s) : typeof c == "number" && Number.isFinite(c) ? Math.max(0, Math.round(c * n.timescale / 1e6)) : n.duration, f = o(o({}, n), {}, {
|
|
48
|
+
timestamp: n.timestamp + Math.round(l * n.timescale / s),
|
|
49
|
+
duration: d,
|
|
50
|
+
type: "audio",
|
|
51
|
+
format: "f32",
|
|
52
|
+
data: u,
|
|
53
|
+
sampleRate: s,
|
|
54
|
+
channels: a,
|
|
55
|
+
statistics: {
|
|
56
|
+
decodeTime: Math.max(performance.now() - r, 0),
|
|
57
|
+
transportTimeFromWorker: 0,
|
|
58
|
+
transportTimeToWorker: 0,
|
|
59
|
+
samplesInBatch: 1
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
this.decodedSamples.push(f);
|
|
63
|
+
} finally {
|
|
64
|
+
e.close();
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
error: (e) => {
|
|
68
|
+
this.logger.error("Decoder error:", e.name, e.message), this.resetDecoderState(), this.errors.push(e);
|
|
69
|
+
}
|
|
70
|
+
})), e(this, "buildCodecString", a), e(this, "getDescription", (e, t) => {
|
|
71
|
+
let n = this.initSegments.get(t.renditionId);
|
|
72
|
+
if (n && n.data.byteLength > 0 && n.codec === e) return n.data;
|
|
73
|
+
if (e === "opus") return i(t.channels, t.sampleRate);
|
|
74
|
+
if (e === "aac") return r(t.channels, t.sampleRate);
|
|
75
|
+
}), e(this, "reset", () => {
|
|
76
|
+
this.decodedSamples = [], this.decoder && this.decoder.state !== "closed" && this.decoder.reset(), this.resetDecoderState();
|
|
77
|
+
}), e(this, "unload", () => {
|
|
78
|
+
this.reset(), this.decoder && this.decoder.state !== "closed" && this.decoder.close(), this.decoder = null;
|
|
79
|
+
}), e(this, "initSegment", (e) => {
|
|
80
|
+
this.initSegments.set(e.renditionId, e);
|
|
81
|
+
}), e(this, "enqueue", (e) => {
|
|
82
|
+
var t, n;
|
|
83
|
+
let r = this.ensureDecoder(), i = e.codec, a = ((t = this.previousSample) == null ? void 0 : t.channelId) !== e.channelId, o = ((n = this.previousSample) == null ? void 0 : n.renditionId) !== e.renditionId, s = this.previousCodec !== i;
|
|
84
|
+
if (!this.previousSample || a || o || s) {
|
|
85
|
+
if (this.previousSample && r.state === "configured") {
|
|
86
|
+
let e = this.sentCount;
|
|
87
|
+
r.flush().then(() => this.dropUndecoded(e), (e) => {
|
|
88
|
+
this.logger.warn("Failed to flush before reconfiguration:", e);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
let t = this.buildCodecString(i), { description: n, preSkip: a } = i === "opus" ? l(this.getDescription(i, e)) : {
|
|
92
|
+
description: this.getDescription(i, e),
|
|
93
|
+
preSkip: 0
|
|
94
|
+
}, o = {
|
|
95
|
+
codec: t,
|
|
96
|
+
sampleRate: e.sampleRate,
|
|
97
|
+
numberOfChannels: e.channels,
|
|
98
|
+
description: n
|
|
99
|
+
};
|
|
100
|
+
try {
|
|
101
|
+
r.configure(o), this.previousCodec = i, this.priming = { remaining: a };
|
|
102
|
+
} catch (t) {
|
|
103
|
+
this.logger.error(`Failed to configure decoder for ${i} (rendition ${e.renditionId}), dropping sample`, t), this.errors.push(t instanceof Error ? t : /* @__PURE__ */ Error(`Failed to configure decoder for ${i}`)), r.state === "configured" && r.reset(), this.resetDecoderState(), this.ensureDecoder();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (e.timescale <= 0) {
|
|
108
|
+
this.logger.error(`Invalid timescale ${e.timescale} in sample, dropping sample`);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.previousSample = e;
|
|
112
|
+
let c = Math.floor(1e6 * e.timestamp / e.timescale), u = Math.floor(1e6 * e.duration / e.timescale), d;
|
|
113
|
+
try {
|
|
114
|
+
d = new EncodedAudioChunk({
|
|
115
|
+
type: "key",
|
|
116
|
+
timestamp: c,
|
|
117
|
+
duration: u > 0 ? u : void 0,
|
|
118
|
+
data: e.data
|
|
119
|
+
});
|
|
120
|
+
} catch (e) {
|
|
121
|
+
this.logger.error("Failed to create chunk:", e);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.pendingSamples.push({
|
|
125
|
+
sample: e,
|
|
126
|
+
decodeStartTime: performance.now(),
|
|
127
|
+
priming: this.priming
|
|
128
|
+
}), this.sentCount++;
|
|
129
|
+
try {
|
|
130
|
+
r.decode(d);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
this.logger.error("Failed to decode chunk:", e), this.pendingSamples.popLast(), this.sentCount--, r.state === "closed" && (this.resetDecoderState(), this.ensureDecoder());
|
|
133
|
+
}
|
|
134
|
+
}), e(this, "flush", t(function* () {
|
|
135
|
+
if (c.decoder && c.decoder.state === "configured") try {
|
|
136
|
+
let e = c.sentCount;
|
|
137
|
+
yield c.decoder.flush(), c.dropUndecoded(e);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
c.logger.error("Failed to flush decoder:", e), c.resetDecoderState();
|
|
140
|
+
}
|
|
141
|
+
})), e(this, "error", () => this.errors.pop()), e(this, "take", () => this.decodedSamples.shift()), this.logger = s, this.decoder = this.createDecoder();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
s = u, e(u, "isSupported", () => c.AudioDecoder !== void 0), e(u, "create", function() {
|
|
145
|
+
var e = t(function* (e) {
|
|
146
|
+
if (!s.isSupported()) throw Error("WebCodecs AudioDecoder is not supported in this environment");
|
|
147
|
+
return new s(e);
|
|
148
|
+
});
|
|
149
|
+
return function(t) {
|
|
150
|
+
return e.apply(this, arguments);
|
|
151
|
+
};
|
|
152
|
+
}());
|
|
153
|
+
//#endregion
|
|
154
|
+
export { u as WebCodecsAudioDecoderContext };
|
package/BdMchGeH.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { n as e } from "./BsfwXDui.js";
|
|
2
|
+
import { i as t, n, t as r } from "./DSw1XhvD.js";
|
|
3
|
+
//#region ../../libs/utils/src/BitReader.ts
|
|
4
|
+
var i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), s = class {
|
|
5
|
+
constructor(s, c = 0) {
|
|
6
|
+
t(this, i, void 0), t(this, a, void 0), t(this, o, void 0), e(this, "position", () => r(o, this)), e(this, "peekBit", () => this.getBit(r(a, this), r(o, this))), e(this, "readBit", () => {
|
|
7
|
+
var e;
|
|
8
|
+
let t = this.peekBit();
|
|
9
|
+
return n(o, this, (e = r(o, this), e++, e)), t;
|
|
10
|
+
}), e(this, "readBits", (e) => {
|
|
11
|
+
let t = 0;
|
|
12
|
+
for (let c = 0; c < e; c++) {
|
|
13
|
+
var i, s;
|
|
14
|
+
t = t << 1 | (this.getBit(r(a, this), (n(o, this, (i = r(o, this), s = i++, i)), s)) ? 1 : 0);
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
}), e(this, "remainingBits", () => r(a, this).byteLength * 8 - r(o, this)), e(this, "readSignedExpGolomb", () => {
|
|
18
|
+
let e = this.readUnsignedExpGolomb();
|
|
19
|
+
return e & 1 ? (e + 1) / 2 : -(e / 2);
|
|
20
|
+
}), e(this, "readUnsignedExpGolomb", () => {
|
|
21
|
+
var e, t;
|
|
22
|
+
let i = 0;
|
|
23
|
+
for (; this.getBit(r(a, this), (n(o, this, (e = r(o, this), t = e++, e)), t)) === 0;) i++;
|
|
24
|
+
let s = 1 << i;
|
|
25
|
+
for (let e = i - 1; e >= 0; e--) {
|
|
26
|
+
var c, l;
|
|
27
|
+
s |= this.getBit(r(a, this), (n(o, this, (c = r(o, this), l = c++, c)), l)) << e;
|
|
28
|
+
}
|
|
29
|
+
return s - 1;
|
|
30
|
+
}), e(this, "getBit", (e, t) => {
|
|
31
|
+
if (e.byteLength * 8 <= t) throw Error("BitReader: Out of bounds");
|
|
32
|
+
return e[t >> 3] >> 7 - (t & 7) & 1;
|
|
33
|
+
}), n(i, this, s), n(a, this, new Uint8Array(r(i, this))), n(o, this, c);
|
|
34
|
+
}
|
|
35
|
+
bytes() {
|
|
36
|
+
return r(a, this);
|
|
37
|
+
}
|
|
38
|
+
}, c = [
|
|
39
|
+
96e3,
|
|
40
|
+
88200,
|
|
41
|
+
64e3,
|
|
42
|
+
48e3,
|
|
43
|
+
44100,
|
|
44
|
+
32e3,
|
|
45
|
+
24e3,
|
|
46
|
+
22050,
|
|
47
|
+
16e3,
|
|
48
|
+
12e3,
|
|
49
|
+
11025,
|
|
50
|
+
8e3,
|
|
51
|
+
7350
|
|
52
|
+
], l = (e, t) => {
|
|
53
|
+
let n = c.indexOf(t);
|
|
54
|
+
if (n === -1 || e < 1 || e > 8 || e === 7) return;
|
|
55
|
+
let r = /* @__PURE__ */ new ArrayBuffer(2), i = new Uint8Array(r), a = e === 8 ? 7 : e;
|
|
56
|
+
return i[0] = 16 | n >> 1, i[1] = (n & 1) << 7 | a << 3, r;
|
|
57
|
+
}, u = [
|
|
58
|
+
void 0,
|
|
59
|
+
1,
|
|
60
|
+
2,
|
|
61
|
+
3,
|
|
62
|
+
4,
|
|
63
|
+
5,
|
|
64
|
+
6,
|
|
65
|
+
8,
|
|
66
|
+
void 0,
|
|
67
|
+
void 0,
|
|
68
|
+
void 0,
|
|
69
|
+
7,
|
|
70
|
+
8,
|
|
71
|
+
24,
|
|
72
|
+
8
|
|
73
|
+
], d = 5, f = 29, p = new Set([
|
|
74
|
+
1,
|
|
75
|
+
2,
|
|
76
|
+
3,
|
|
77
|
+
4
|
|
78
|
+
]), m = 695, h = 1352, g = (e) => {
|
|
79
|
+
let t = new s(e.slice().buffer), n = (e) => t.remainingBits() >= e, r = () => {
|
|
80
|
+
if (!n(5)) return;
|
|
81
|
+
let e = t.readBits(5);
|
|
82
|
+
return e === 31 ? n(6) ? 32 + t.readBits(6) : void 0 : e;
|
|
83
|
+
}, i = () => {
|
|
84
|
+
if (!n(4)) return;
|
|
85
|
+
let e = t.readBits(4);
|
|
86
|
+
return e === 15 ? n(24) ? t.readBits(24) : void 0 : c[e];
|
|
87
|
+
}, a = r(), o = i();
|
|
88
|
+
if (!a || !o || !n(4)) return;
|
|
89
|
+
let l = t.readBits(4), g = u[l];
|
|
90
|
+
if (a !== d && a !== f) {
|
|
91
|
+
if (!p.has(a) || l === 0 || !n(2)) return {
|
|
92
|
+
sampleRate: o,
|
|
93
|
+
channelCount: g
|
|
94
|
+
};
|
|
95
|
+
if (t.readBits(1), t.readBits(1) === 1) {
|
|
96
|
+
if (!n(14)) return {
|
|
97
|
+
sampleRate: o,
|
|
98
|
+
channelCount: g
|
|
99
|
+
};
|
|
100
|
+
t.readBits(14);
|
|
101
|
+
}
|
|
102
|
+
if (!n(1)) return {
|
|
103
|
+
sampleRate: o,
|
|
104
|
+
channelCount: g
|
|
105
|
+
};
|
|
106
|
+
if (t.readBits(1) === 1) {
|
|
107
|
+
if (!n(1)) return {
|
|
108
|
+
sampleRate: o,
|
|
109
|
+
channelCount: g
|
|
110
|
+
};
|
|
111
|
+
t.readBits(1);
|
|
112
|
+
}
|
|
113
|
+
if (!n(16) || t.readBits(11) !== m || r() !== d || !n(1) || t.readBits(1) === 0) return {
|
|
114
|
+
sampleRate: o,
|
|
115
|
+
channelCount: g
|
|
116
|
+
};
|
|
117
|
+
let e = i();
|
|
118
|
+
return e ? {
|
|
119
|
+
sampleRate: e,
|
|
120
|
+
channelCount: n(12) && t.readBits(11) === h && t.readBits(1) === 1 && g === 1 ? 2 : g
|
|
121
|
+
} : {
|
|
122
|
+
sampleRate: o,
|
|
123
|
+
channelCount: g
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
let _ = i();
|
|
127
|
+
if (!(!_ || r() === void 0)) return a === f && g === 1 && (g = 2), {
|
|
128
|
+
sampleRate: _,
|
|
129
|
+
channelCount: g
|
|
130
|
+
};
|
|
131
|
+
}, _ = (e) => {
|
|
132
|
+
if (!e) return;
|
|
133
|
+
let t = e.channelMappingTable, n = new Uint8Array(19 + t.byteLength), r = new DataView(n.buffer, n.byteOffset, n.byteLength);
|
|
134
|
+
return n.set([
|
|
135
|
+
79,
|
|
136
|
+
112,
|
|
137
|
+
117,
|
|
138
|
+
115,
|
|
139
|
+
72,
|
|
140
|
+
101,
|
|
141
|
+
97,
|
|
142
|
+
100
|
|
143
|
+
], 0), r.setUint8(8, 1), r.setUint8(9, e.channelCount), r.setUint16(10, e.preSkip, !0), r.setUint32(12, e.inputSampleRate, !0), r.setInt16(16, e.outputGain, !0), r.setUint8(18, e.channelMappingFamily), t.byteLength > 0 && n.set(t, 19), n;
|
|
144
|
+
}, v = (e, t) => {
|
|
145
|
+
if (e < 1 || e > 2) return;
|
|
146
|
+
let n = new Uint8Array(19), r = new DataView(n.buffer, n.byteOffset, n.byteLength);
|
|
147
|
+
return n.set([
|
|
148
|
+
79,
|
|
149
|
+
112,
|
|
150
|
+
117,
|
|
151
|
+
115,
|
|
152
|
+
72,
|
|
153
|
+
101,
|
|
154
|
+
97,
|
|
155
|
+
100
|
|
156
|
+
]), r.setUint8(8, 1), r.setUint8(9, e), r.setUint16(10, 3840, !0), r.setUint32(12, t, !0), r.setInt16(16, 0, !0), r.setUint8(18, 0), n;
|
|
157
|
+
}, y = (e) => {
|
|
158
|
+
switch (e) {
|
|
159
|
+
case "opus": return "opus";
|
|
160
|
+
case "aac": return "mp4a.40.2";
|
|
161
|
+
case "mp3": return "mp3";
|
|
162
|
+
default: {
|
|
163
|
+
let t = e;
|
|
164
|
+
throw Error(`Unsupported audio codec: ${t}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
export { g as a, l as i, v as n, s as o, _ as r, y as t };
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { n as e, t } from "./BsfwXDui.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n, r } from "./C6y28igI.js";
|
|
3
3
|
//#region ../../libs/cast-sender/src/CastSender.ts
|
|
4
|
-
var
|
|
5
|
-
constructor(
|
|
6
|
-
var
|
|
7
|
-
super(),
|
|
4
|
+
var i = 1e4, a = "CastSender was unloaded before the Google Cast SDK finished initializing", o = class extends r {
|
|
5
|
+
constructor(r) {
|
|
6
|
+
var o;
|
|
7
|
+
super(), o = this, e(this, "state", "not casting"), e(this, "config", void 0), e(this, "unloaded", !1), e(this, "logger", n.get().createContext("CastSender")), e(this, "devicesAvailable", void 0), e(this, "updateAuthenticationToken", (e) => {
|
|
8
8
|
this.config && (this.config.options.authenticationToken = e, this.send({
|
|
9
9
|
type: "updateAuthToken",
|
|
10
10
|
token: e
|
|
11
11
|
}));
|
|
12
12
|
}), e(this, "unload", () => {
|
|
13
13
|
var e;
|
|
14
|
-
this.unloaded = !0, (e = this.getSession()) == null || e.removeMessageListener("urn:x-cast:com.vindral.castdata", this.onMessage);
|
|
14
|
+
this.unloaded = !0, (e = this.getSession()) == null || e.removeMessageListener("urn:x-cast:com.vindral.castdata", this.onMessage), this.devicesAvailable && this.emit("devices available", !1), this.devicesAvailable = void 0;
|
|
15
15
|
}), e(this, "init", t(function* () {
|
|
16
16
|
return new Promise((e, t) => {
|
|
17
|
-
let n = !1,
|
|
18
|
-
n = !0, t();
|
|
19
|
-
},
|
|
20
|
-
window.__onGCastApiAvailable = (
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (clearTimeout(i), !a) return t();
|
|
17
|
+
let n = !1, r = setTimeout(() => {
|
|
18
|
+
n = !0, t(/* @__PURE__ */ Error(`Timed out after ${i} ms waiting for the Google Cast SDK`));
|
|
19
|
+
}, i);
|
|
20
|
+
window.__onGCastApiAvailable = (i) => {
|
|
21
|
+
if (clearTimeout(r), o.unloaded) return t(Error(a));
|
|
22
|
+
if (!i) return t(/* @__PURE__ */ Error("The Google Cast SDK reported the Cast API as unavailable"));
|
|
26
23
|
setTimeout(() => {
|
|
24
|
+
if (o.unloaded) return t(Error(a));
|
|
27
25
|
try {
|
|
28
|
-
|
|
26
|
+
o.onGCastApiAvailable(), e();
|
|
29
27
|
} catch (e) {
|
|
30
|
-
|
|
28
|
+
let r = e instanceof Error ? e : Error(String(e));
|
|
29
|
+
n && o.logger.warn("Late Google Cast SDK initialization failed", r), t(r);
|
|
31
30
|
}
|
|
32
31
|
}, 1e3);
|
|
33
|
-
},
|
|
32
|
+
}, o.castLibrariesAdded() && window.cast ? window.__onGCastApiAvailable(!0) : o.verifyCastLibraries();
|
|
34
33
|
});
|
|
35
34
|
})), e(this, "start", t(function* () {
|
|
36
35
|
var e;
|
|
37
|
-
yield (e =
|
|
36
|
+
yield (e = o.getInstance()) == null ? void 0 : e.requestSession();
|
|
38
37
|
})), e(this, "stop", () => {
|
|
39
38
|
var e;
|
|
40
39
|
(e = this.getSession()) == null || e.endSession(!0);
|
|
@@ -50,7 +49,7 @@ var r = class extends n {
|
|
|
50
49
|
receiverApplicationId: r,
|
|
51
50
|
autoJoinPolicy: chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,
|
|
52
51
|
resumeSavedSession: !0
|
|
53
|
-
}), t.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED, this.onSessionStateChanged), n === cast.framework.SessionState.SESSION_STARTED && setTimeout(() => {
|
|
52
|
+
}), t.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED, this.onSessionStateChanged), t.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED, this.onCastStateChanged), this.updateDevicesAvailable(t.getCastState()), n === cast.framework.SessionState.SESSION_STARTED && setTimeout(() => {
|
|
54
53
|
this.state = "casting", this.emit("resumed");
|
|
55
54
|
});
|
|
56
55
|
}), e(this, "send", (e) => {
|
|
@@ -75,6 +74,11 @@ var r = class extends n {
|
|
|
75
74
|
type: "start",
|
|
76
75
|
config: this.config
|
|
77
76
|
});
|
|
77
|
+
}), e(this, "onCastStateChanged", (e) => {
|
|
78
|
+
this.unloaded || this.updateDevicesAvailable(e.castState);
|
|
79
|
+
}), e(this, "updateDevicesAvailable", (e) => {
|
|
80
|
+
let t = e !== cast.framework.CastState.NO_DEVICES_AVAILABLE;
|
|
81
|
+
t !== this.devicesAvailable && (this.devicesAvailable = t, this.emit("devices available", t));
|
|
78
82
|
}), e(this, "onSessionStateChanged", (e) => {
|
|
79
83
|
if (!this.unloaded) switch (e.sessionState) {
|
|
80
84
|
case cast.framework.SessionState.SESSION_START_FAILED:
|
|
@@ -105,7 +109,7 @@ var r = class extends n {
|
|
|
105
109
|
e.type = "text/javascript", e.id = "vindralCastFrameworkLib", e.src = "//www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js", document.head.appendChild(e);
|
|
106
110
|
let t = document.createElement("script");
|
|
107
111
|
t.type = "text/javascript", t.id = "vindralCastSenderLib", t.src = "//www.gstatic.com/cv/js/sender/v1/cast_sender.js", document.head.appendChild(t);
|
|
108
|
-
}), this.config =
|
|
112
|
+
}), this.config = r;
|
|
109
113
|
}
|
|
110
114
|
get casting() {
|
|
111
115
|
return this.state === "casting";
|
|
@@ -140,4 +144,4 @@ var r = class extends n {
|
|
|
140
144
|
}
|
|
141
145
|
};
|
|
142
146
|
//#endregion
|
|
143
|
-
export {
|
|
147
|
+
export { o as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./BsfwXDui.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as t, n, t as r } from "./DSw1XhvD.js";
|
|
3
3
|
//#region ../../libs/utils/src/formatting.ts
|
|
4
4
|
var i = 1e3, a = i * 1e3, o = a * 1e3, s = (e, t, n) => e % t === 0 ? e / t : (e / t).toFixed(n), c = (e, t = 1) => e >= o ? `${s(e, o, t)} Gbit/s` : e >= a ? `${s(e, a, t)} Mbit/s` : e >= i ? `${s(e, i, t)} Kbit/s` : `${e} bit/s`, l = ({ width: e, height: t }) => `${e}x${t}`, u = {
|
|
5
5
|
PAUSED: "paused",
|
|
@@ -151,17 +151,17 @@ var T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = /*
|
|
|
151
151
|
}), t(this, D, (e) => {
|
|
152
152
|
let { key: t } = e;
|
|
153
153
|
if (!this.keysUsed.includes(t)) {
|
|
154
|
-
this.removeEventListener("keyup",
|
|
154
|
+
this.removeEventListener("keyup", r(D, this));
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
157
|
this.handleClick(e);
|
|
158
158
|
}), t(this, O, (e) => {
|
|
159
|
-
let { metaKey: t, altKey:
|
|
160
|
-
if (t ||
|
|
161
|
-
this.removeEventListener("keyup",
|
|
159
|
+
let { metaKey: t, altKey: n, key: i } = e;
|
|
160
|
+
if (t || n || !this.keysUsed.includes(i)) {
|
|
161
|
+
this.removeEventListener("keyup", r(D, this));
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
this.addEventListener("keyup",
|
|
164
|
+
this.addEventListener("keyup", r(D, this), { once: !0 });
|
|
165
165
|
}), this.attachShadow({ mode: "open" }).appendChild(w.content.cloneNode(!0));
|
|
166
166
|
}
|
|
167
167
|
get keysUsed() {
|
|
@@ -169,17 +169,17 @@ var T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = /*
|
|
|
169
169
|
}
|
|
170
170
|
connectedCallback() {
|
|
171
171
|
var e;
|
|
172
|
-
|
|
172
|
+
n(T, this, this.closest("vindral-controller")), (e = r(T, this)) == null || e.connectListener(this), this.hasAttribute("disabled") || this.enable(), this.setAttribute("role", "button");
|
|
173
173
|
}
|
|
174
174
|
enable() {
|
|
175
|
-
this.addEventListener("click",
|
|
175
|
+
this.addEventListener("click", r(E, this)), this.addEventListener("keydown", r(O, this)), this.tabIndex = 0;
|
|
176
176
|
}
|
|
177
177
|
disable() {
|
|
178
|
-
this.removeEventListener("click",
|
|
178
|
+
this.removeEventListener("click", r(E, this)), this.removeEventListener("keydown", r(O, this)), this.removeEventListener("keyup", r(D, this)), this.tabIndex = -1;
|
|
179
179
|
}
|
|
180
180
|
disconnectedCallback() {
|
|
181
181
|
var e;
|
|
182
|
-
(e =
|
|
182
|
+
(e = r(T, this)) == null || e.disconnectListener(this);
|
|
183
183
|
}
|
|
184
184
|
attributeChangedCallback(e, t, n) {
|
|
185
185
|
e === "disabled" && (y(n) ? this.disable() : this.enable());
|
|
@@ -220,6 +220,6 @@ function N(e, t, n, r) {
|
|
|
220
220
|
}
|
|
221
221
|
//#endregion
|
|
222
222
|
//#region ../../libs/player-next/src/constants.ts
|
|
223
|
-
var P = 5e3;
|
|
223
|
+
var P = 5e3, F = "https://lb.cdn.vindral.com";
|
|
224
224
|
//#endregion
|
|
225
|
-
export {
|
|
225
|
+
export { u as _, y as a, l as b, x as c, g as d, p as f, f as g, h, k as i, m as l, C as m, F as n, _ as o, v as p, N as r, b as s, P as t, S as u, d as v, c as y };
|
package/C6y28igI.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { n as e } from "./BsfwXDui.js";
|
|
2
|
+
import { i as t, n, t as r } from "./DSw1XhvD.js";
|
|
3
|
+
//#region ../../libs/utils/src/Emitter.ts
|
|
4
|
+
var i = class {
|
|
5
|
+
constructor() {
|
|
6
|
+
e(this, "listeners", {});
|
|
7
|
+
}
|
|
8
|
+
emit(e, t) {
|
|
9
|
+
let n = this.listeners[e];
|
|
10
|
+
if (n) {
|
|
11
|
+
let r = !1;
|
|
12
|
+
for (let e = 0; e < n.length; e++) if (n[e].once) {
|
|
13
|
+
r = !0;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
r && (this.listeners[e] = n.filter((e) => !e.once));
|
|
17
|
+
let i, a = n.length;
|
|
18
|
+
for (let e = 0; e < a; e++) {
|
|
19
|
+
let r = n[e].fn(t);
|
|
20
|
+
typeof r == "function" && (i || (i = []), i.push(r));
|
|
21
|
+
}
|
|
22
|
+
if (i) for (let e = 0; e < i.length; e++) i[e]();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
off(e, t) {
|
|
26
|
+
let n = this.listeners[e];
|
|
27
|
+
n && (this.listeners[e] = n.filter((e) => e.fn !== t));
|
|
28
|
+
}
|
|
29
|
+
on(e, t) {
|
|
30
|
+
this.add(e, t, !1);
|
|
31
|
+
}
|
|
32
|
+
once(e, t) {
|
|
33
|
+
this.add(e, t, !0);
|
|
34
|
+
}
|
|
35
|
+
hasListeners(e) {
|
|
36
|
+
let t = this.listeners[e];
|
|
37
|
+
return t !== void 0 && t.length > 0;
|
|
38
|
+
}
|
|
39
|
+
reset() {
|
|
40
|
+
this.listeners = {};
|
|
41
|
+
}
|
|
42
|
+
add(e, t, n) {
|
|
43
|
+
let r = this.listeners[e], i = {
|
|
44
|
+
fn: t,
|
|
45
|
+
once: n
|
|
46
|
+
};
|
|
47
|
+
r ? r.push(i) : this.listeners[e] = [i];
|
|
48
|
+
}
|
|
49
|
+
}, a = [
|
|
50
|
+
"off",
|
|
51
|
+
"error",
|
|
52
|
+
"warn",
|
|
53
|
+
"info",
|
|
54
|
+
"debug",
|
|
55
|
+
"trace"
|
|
56
|
+
], o = {
|
|
57
|
+
ERROR: "error",
|
|
58
|
+
WARN: "warn",
|
|
59
|
+
INFO: "info",
|
|
60
|
+
DEBUG: "debug",
|
|
61
|
+
TRACE: "trace",
|
|
62
|
+
OFF: "off"
|
|
63
|
+
}, s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = class i {
|
|
64
|
+
constructor({ context: i, logLevel: a, debug: o }) {
|
|
65
|
+
t(this, s, /* @__PURE__ */ new Map()), t(this, c, ""), t(this, l, !1), t(this, u, "off"), e(this, "trace", (...e) => {}), e(this, "debug", (...e) => {}), e(this, "info", (...e) => {}), e(this, "warn", (...e) => {}), e(this, "error", (...e) => {}), e(this, "table", (...e) => {}), e(this, "count", (...e) => {}), n(c, this, i), n(u, this, a), n(l, this, o || !1), this.setLevel(a), this.setDebug(r(l, this));
|
|
66
|
+
}
|
|
67
|
+
setDebug(e) {
|
|
68
|
+
n(l, this, e);
|
|
69
|
+
for (let [t, n] of r(s, this)) n.setDebug(e);
|
|
70
|
+
e ? (this.table = console.table.bind(console), this.count = console.count.bind(console)) : (this.table = () => {}, this.count = () => {});
|
|
71
|
+
}
|
|
72
|
+
getLevel() {
|
|
73
|
+
return r(u, this);
|
|
74
|
+
}
|
|
75
|
+
setLevel(e) {
|
|
76
|
+
n(u, this, e);
|
|
77
|
+
for (let [t, n] of r(s, this)) n.setLevel(e);
|
|
78
|
+
let t = a.indexOf(e);
|
|
79
|
+
for (let [e, n] of a.entries()) n !== "off" && (e <= t ? this[n] = console[n].bind(console, "%c%s %c%s", "font-weight:bold;", n.toUpperCase(), "font-weight:normal;", r(c, this)) : this[n] = () => {});
|
|
80
|
+
}
|
|
81
|
+
createContext(e) {
|
|
82
|
+
let t = r(s, this).get(e);
|
|
83
|
+
if (!t) {
|
|
84
|
+
let t = new i({
|
|
85
|
+
context: `${e}`,
|
|
86
|
+
logLevel: r(u, this),
|
|
87
|
+
debug: r(l, this)
|
|
88
|
+
});
|
|
89
|
+
return r(s, this).set(e, t), t;
|
|
90
|
+
}
|
|
91
|
+
return t;
|
|
92
|
+
}
|
|
93
|
+
static get() {
|
|
94
|
+
return f._ || (f._ = new i({
|
|
95
|
+
context: "Vindral",
|
|
96
|
+
logLevel: "off"
|
|
97
|
+
})), f._;
|
|
98
|
+
}
|
|
99
|
+
}, f = { _: void 0 };
|
|
100
|
+
//#endregion
|
|
101
|
+
export { d as n, i as r, o as t };
|