@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/C01DcfYu.js DELETED
@@ -1,118 +0,0 @@
1
- import { n as e } from "./BsfwXDui.js";
2
- import { t } from "./RxoWWyzp.js";
3
- //#region ../../libs/utils/src/noop.ts
4
- var n = () => {}, r = "connection_failed", i = "connection_failed_will_not_attempt_again", a = "authentication_error", o = "authentication_expired", s = "channel_not_found", c = "no_incoming_data_error", l = "connection_inactivity", u = "missing_init_segment", d = "no_track_context", f = "invalid_track_context_state", p = "disconnected_by_edge", m = "decoder_error", h = "audio_player_error", g = "unsupported_audio_codec", _ = "media_source_error", v = "webgl_context_lost_error", y = "access_forbidden", b = "channel_switch_failed", x = "drm_error", S = class extends Error {
5
- constructor(n, r, i = {}) {
6
- super(n), e(this, "props", void 0), e(this, "extra", {}), e(this, "code", () => this.props.code), e(this, "isFatal", () => this.props.isFatal), e(this, "source", () => this.props.source), e(this, "type", () => {
7
- var e;
8
- return (e = this.props.type) == null ? "external" : e;
9
- }), e(this, "toStringifiable", () => {
10
- var e;
11
- let n = this.source(), r = n instanceof Error ? n.stack : this.stack;
12
- return t(t({}, this.extra), {}, {
13
- code: this.props.code,
14
- isFatal: this.props.isFatal,
15
- type: this.props.type,
16
- message: this.message,
17
- sourceMessage: (e = this.source()) == null ? void 0 : e.message,
18
- stack: r
19
- });
20
- }), this.props = r, this.extra = i, Object.setPrototypeOf(this, new.target.prototype);
21
- }
22
- }, C = (e, t) => new S("MediaElement Error", {
23
- isFatal: e,
24
- code: "media_element_error",
25
- source: t
26
- }, { mediaErrorCode: t.code }), w = (e, t) => new S("Decoder Error", {
27
- isFatal: e,
28
- code: m,
29
- source: t,
30
- type: "internal"
31
- }), T = (e, t, n) => new S(`No decoder available for audio codec "${e}" in non-MSE playback. ${t}`, {
32
- isFatal: !0,
33
- code: g,
34
- source: n,
35
- type: "external"
36
- }, {
37
- codec: e,
38
- reason: t
39
- }), E = (e, t) => new S("Audio Player Error", {
40
- isFatal: e,
41
- code: h,
42
- source: t,
43
- type: "internal"
44
- }), D = (e, t) => new S(`No init segment for rendition id ${e} for channel ${t}`, {
45
- isFatal: !1,
46
- code: u,
47
- type: "internal"
48
- }), O = (e, t, n, r) => new S("MediaSource Error", {
49
- isFatal: e,
50
- code: _,
51
- source: t,
52
- type: "internal"
53
- }, {
54
- type: r,
55
- consecutiveErrorsCount: n
56
- }), k = (e, t) => new S(`No track context for ${e}${t ? `, rendition id ${t}` : ""}`, {
57
- isFatal: !1,
58
- code: d,
59
- type: "internal"
60
- }), A = (e, t) => new S(`Track context is in an invalid state for ${e}${t ? `, rendition id ${t}` : ""}`, {
61
- isFatal: !1,
62
- code: f,
63
- type: "internal"
64
- }), j = () => new S("Web Audio Context resume timeout", {
65
- isFatal: !1,
66
- code: "web_audio_context_resume_timeout"
67
- }), M = (e) => new S("Disconnected From Edge Server", {
68
- type: "external",
69
- source: e,
70
- isFatal: !1,
71
- code: p
72
- }), N = (e) => new S("Authentication Failed", {
73
- isFatal: !0,
74
- code: a,
75
- source: e
76
- }), P = (e) => new S("Authentication Expired", {
77
- isFatal: !0,
78
- code: o,
79
- source: e
80
- }), F = (e, t) => new S("Connection closed due to inactivity", {
81
- isFatal: !1,
82
- code: l,
83
- source: t,
84
- type: e
85
- }), I = (e, t) => new S("Channel not found", {
86
- isFatal: !1,
87
- code: s,
88
- source: t,
89
- type: e
90
- }), L = (e) => new S("No Incoming Data", {
91
- isFatal: !1,
92
- code: c,
93
- source: e
94
- }), R = (e) => new S("Connection attempt failed", {
95
- isFatal: !1,
96
- code: r,
97
- source: e
98
- }), z = () => new S("Connection failed - no more reconnect attempts", {
99
- isFatal: !0,
100
- code: i
101
- }), B = (e) => new S("WebGL Context Lost", {
102
- isFatal: !1,
103
- code: v,
104
- source: e,
105
- type: "internal"
106
- }), V = (e) => new S(e, {
107
- isFatal: !0,
108
- code: y
109
- }), H = (e) => new S(`Channel switch to '${e}' failed`, {
110
- isFatal: !1,
111
- code: b
112
- }), U = (e, t = !1, n) => new S(e, {
113
- isFatal: t,
114
- code: x,
115
- source: n
116
- });
117
- //#endregion
118
- export { T as A, C, k as D, L as E, n as M, z as O, A as S, D as T, H as _, i as a, U as b, l as c, V as d, j as f, I as g, P as h, s as i, B as j, R as k, c as l, N as m, o as n, r as o, E as p, a as r, p as s, y as t, S as u, w as v, O as w, F as x, M as y };
package/Cug44nXk.js DELETED
@@ -1,149 +0,0 @@
1
- import { n as e, t } from "./BsfwXDui.js";
2
- import { t as n } from "./DrWNJwZx.js";
3
- import { t as r } from "./RxoWWyzp.js";
4
- import { i, n as a, t as o } from "./Bt-ONXfO.js";
5
- //#region ../../libs/web-sdk/src/decoders/PendingSampleMap.ts
6
- var s = class {
7
- constructor() {
8
- e(this, "map", /* @__PURE__ */ new Map());
9
- }
10
- enqueue(e, t) {
11
- let r = this.map.get(e);
12
- if (r) r.push(t);
13
- else {
14
- let r = new n(Infinity);
15
- r.push(t), this.map.set(e, r);
16
- }
17
- }
18
- dequeue(e) {
19
- let t = this.map.get(e);
20
- if (!t) return;
21
- let n = t.pop();
22
- return t.isEmpty() && this.map.delete(e), n;
23
- }
24
- dequeueWithFallback(e) {
25
- let t = this.dequeue(e);
26
- if (t !== void 0) return t;
27
- for (let [e, t] of this.map) {
28
- let n = t.pop();
29
- if (t.isEmpty() && this.map.delete(e), n !== void 0) return n;
30
- }
31
- }
32
- removeLast(e) {
33
- let t = this.map.get(e);
34
- t && (t.popLast(), t.isEmpty() && this.map.delete(e));
35
- }
36
- clear() {
37
- this.map.clear();
38
- }
39
- }, c, l = globalThis, u = class {
40
- constructor(c) {
41
- var l = this;
42
- 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 s()), e(this, "errors", new n(10)), e(this, "resetDecoderState", () => {
43
- this.pendingSamples.clear(), this.previousSample = void 0, this.previousCodec = void 0;
44
- }), e(this, "ensureDecoder", () => ((!this.decoder || this.decoder.state === "closed") && (this.decoder = this.createDecoder()), this.decoder)), e(this, "createDecoder", () => new AudioDecoder({
45
- output: (e) => {
46
- let t = this.pendingSamples.dequeueWithFallback(e.timestamp);
47
- if (!t) {
48
- e.close();
49
- return;
50
- }
51
- let { sample: n, decodeStartTime: i } = t;
52
- try {
53
- let t = e.numberOfFrames, a = e.numberOfChannels, o = e.sampleRate, s = e.timestamp, c = e.duration, l = new Float32Array(t * a);
54
- e.copyTo(l, {
55
- planeIndex: 0,
56
- format: "f32"
57
- });
58
- let u = Math.round(s * n.timescale / 1e6), d = typeof c == "number" && Number.isFinite(c) ? Math.max(0, Math.round(c * n.timescale / 1e6)) : n.duration, f = r(r({}, n), {}, {
59
- timestamp: u,
60
- duration: d,
61
- type: "audio",
62
- format: "f32",
63
- data: l,
64
- sampleRate: o,
65
- channels: a,
66
- statistics: {
67
- decodeTime: Math.max(performance.now() - i, 0),
68
- transportTimeFromWorker: 0,
69
- transportTimeToWorker: 0,
70
- samplesInBatch: 1
71
- }
72
- });
73
- this.decodedSamples.push(f);
74
- } finally {
75
- e.close();
76
- }
77
- },
78
- error: (e) => {
79
- this.logger.error("Decoder error:", e.name, e.message), this.resetDecoderState(), this.errors.push(e);
80
- }
81
- })), e(this, "buildCodecString", o), e(this, "getDescription", (e, t) => {
82
- let n = this.initSegments.get(t.renditionId);
83
- if (n && n.data.byteLength > 0 && n.codec === e) return n.data;
84
- if (e === "opus") return a(t.channels, t.sampleRate);
85
- if (e === "aac") return i(t.channels, t.sampleRate);
86
- }), e(this, "unload", () => {
87
- this.decodedSamples = [], this.resetDecoderState(), this.decoder && this.decoder.state !== "closed" && this.decoder.close(), this.decoder = null;
88
- }), e(this, "initSegment", (e) => {
89
- this.initSegments.set(e.renditionId, e);
90
- }), e(this, "enqueue", (e) => {
91
- var t, n;
92
- 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;
93
- if (!this.previousSample || a || o || s) {
94
- this.previousSample && r.state === "configured" && r.flush().catch((e) => {
95
- this.logger.warn("Failed to flush before reconfiguration:", e);
96
- });
97
- let t = this.buildCodecString(i), n = this.getDescription(i, e), a = {
98
- codec: t,
99
- sampleRate: e.sampleRate,
100
- numberOfChannels: e.channels,
101
- description: n
102
- };
103
- try {
104
- r.configure(a), this.previousCodec = i;
105
- } catch (t) {
106
- 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}`)), this.resetDecoderState(), this.ensureDecoder();
107
- return;
108
- }
109
- }
110
- if (e.timescale <= 0) {
111
- this.logger.error(`Invalid timescale ${e.timescale} in sample, dropping sample`);
112
- return;
113
- }
114
- this.previousSample = e;
115
- let c = Math.floor(1e6 * e.timestamp / e.timescale), l = Math.floor(1e6 * e.duration / e.timescale);
116
- try {
117
- let t = new EncodedAudioChunk({
118
- type: "key",
119
- timestamp: c,
120
- duration: l > 0 ? l : void 0,
121
- data: e.data
122
- });
123
- this.pendingSamples.enqueue(c, {
124
- sample: e,
125
- decodeStartTime: performance.now()
126
- }), r.decode(t);
127
- } catch (e) {
128
- this.logger.error("Failed to decode chunk:", e), this.pendingSamples.removeLast(c), r.state === "closed" && (this.resetDecoderState(), this.ensureDecoder());
129
- }
130
- }), e(this, "flush", t(function* () {
131
- if (l.decoder && l.decoder.state === "configured") try {
132
- yield l.decoder.flush();
133
- } catch (e) {
134
- l.logger.error("Failed to flush decoder:", e), l.resetDecoderState();
135
- }
136
- })), e(this, "error", () => this.errors.pop()), e(this, "take", () => this.decodedSamples.shift()), this.logger = c, this.decoder = this.createDecoder();
137
- }
138
- };
139
- c = u, e(u, "isSupported", () => l.AudioDecoder !== void 0), e(u, "create", function() {
140
- var e = t(function* (e) {
141
- if (!c.isSupported()) throw Error("WebCodecs AudioDecoder is not supported in this environment");
142
- return new c(e);
143
- });
144
- return function(t) {
145
- return e.apply(this, arguments);
146
- };
147
- }());
148
- //#endregion
149
- export { u as WebCodecsAudioDecoderContext };
package/FYiEDBC4.js DELETED
@@ -1,50 +0,0 @@
1
- import { n as e } from "./BsfwXDui.js";
2
- //#region ../../libs/utils/src/Emitter.ts
3
- var t = class {
4
- constructor() {
5
- e(this, "listeners", {});
6
- }
7
- emit(e, t) {
8
- let n = this.listeners[e];
9
- if (n) {
10
- let r = !1;
11
- for (let e = 0; e < n.length; e++) if (n[e].once) {
12
- r = !0;
13
- break;
14
- }
15
- r && (this.listeners[e] = n.filter((e) => !e.once));
16
- let i, a = n.length;
17
- for (let e = 0; e < a; e++) {
18
- let r = n[e].fn(t);
19
- typeof r == "function" && (i || (i = []), i.push(r));
20
- }
21
- if (i) for (let e = 0; e < i.length; e++) i[e]();
22
- }
23
- }
24
- off(e, t) {
25
- let n = this.listeners[e];
26
- n && (this.listeners[e] = n.filter((e) => e.fn !== t));
27
- }
28
- on(e, t) {
29
- this.add(e, t, !1);
30
- }
31
- once(e, t) {
32
- this.add(e, t, !0);
33
- }
34
- hasListeners(e) {
35
- let t = this.listeners[e];
36
- return t !== void 0 && t.length > 0;
37
- }
38
- reset() {
39
- this.listeners = {};
40
- }
41
- add(e, t, n) {
42
- let r = this.listeners[e], i = {
43
- fn: t,
44
- once: n
45
- };
46
- r ? r.push(i) : this.listeners[e] = [i];
47
- }
48
- };
49
- //#endregion
50
- export { t };
File without changes
File without changes