@vindral/web-sdk 4.2.0 → 4.2.1-2-gf2a1a13e

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/FYiEDBC4.js ADDED
@@ -0,0 +1,50 @@
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 };
package/RxoWWyzp.js ADDED
@@ -0,0 +1,25 @@
1
+ import { n as e } from "./BsfwXDui.js";
2
+ //#region \0@oxc-project+runtime@0.115.0/helpers/objectSpread2.js
3
+ function t(e, t) {
4
+ var n = Object.keys(e);
5
+ if (Object.getOwnPropertySymbols) {
6
+ var r = Object.getOwnPropertySymbols(e);
7
+ t && (r = r.filter(function(t) {
8
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
9
+ })), n.push.apply(n, r);
10
+ }
11
+ return n;
12
+ }
13
+ function n(n) {
14
+ for (var r = 1; r < arguments.length; r++) {
15
+ var i = arguments[r] == null ? {} : arguments[r];
16
+ r % 2 ? t(Object(i), !0).forEach(function(t) {
17
+ e(n, t, i[t]);
18
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(i)) : t(Object(i)).forEach(function(e) {
19
+ Object.defineProperty(n, e, Object.getOwnPropertyDescriptor(i, e));
20
+ });
21
+ }
22
+ return n;
23
+ }
24
+ //#endregion
25
+ export { n as t };
package/api-client.d.ts CHANGED
@@ -30,7 +30,7 @@ type Tagged<BaseType, Tag extends PropertyKey> = BaseType & {
30
30
  };
31
31
  };
32
32
  type AudioCodec = "aac" | "opus" | "mp3";
33
- type VideoCodec = "h264" | "av1";
33
+ type VideoCodec = "h264" | "h265" | "av1";
34
34
  type WebCodecsHardwareAccelerationPreference = "no-preference" | "prefer-hardware" | "prefer-software";
35
35
  interface ClientOverrides {
36
36
  maxVideoBitRate?: number;
@@ -70,8 +70,8 @@ interface TrackObject {
70
70
  displayWidth?: number;
71
71
  displayHeight?: number;
72
72
  language?: string;
73
- ["com.vindral.variant_uid"]?: string;
74
- ["com.vindral.drm"]?: string;
73
+ "com.vindral.variant_uid"?: string;
74
+ "com.vindral.drm"?: string;
75
75
  }
76
76
  interface CatalogRoot {
77
77
  version: number;
package/api-client.js CHANGED
@@ -1,4 +1,2 @@
1
- import { A as o } from "./CuhQLT-7.js";
2
- export {
3
- o as ApiClient
4
- };
1
+ import { t as e } from "./DeYmk5AL.js";
2
+ export { e as ApiClient };
package/cast-sender.d.ts CHANGED
@@ -53,7 +53,7 @@ declare const LogLevel: {
53
53
  TRACE: "trace";
54
54
  OFF: "off";
55
55
  };
56
- type VideoCodec = "h264" | "av1";
56
+ type VideoCodec = "h264" | "h265" | "av1";
57
57
  interface ReconnectState {
58
58
  /**
59
59
  * The number or retry attempts so far.
@@ -365,27 +365,27 @@ export interface CastSenderEvents {
365
365
  /**
366
366
  * When a connection has been established with a CastReceiver
367
367
  */
368
- ["connected"]: void;
368
+ connected: void;
369
369
  /**
370
370
  * When a previous session has been resumed
371
371
  */
372
- ["resumed"]: void;
372
+ resumed: void;
373
373
  /**
374
374
  * When a CastReceiver has lost or stopped a connection
375
375
  */
376
- ["disconnected"]: void;
376
+ disconnected: void;
377
377
  /**
378
378
  * When a connection attempt was initiated unsuccessfully
379
379
  */
380
- ["failed"]: void;
380
+ failed: void;
381
381
  /**
382
382
  * When the remote connection emits a metadata event
383
383
  */
384
- ["metadata"]: Metadata;
384
+ metadata: Metadata;
385
385
  /**
386
386
  * When the remote connection receives a server wallclock time event
387
387
  */
388
- ["server wallclock time"]: number;
388
+ "server wallclock time": number;
389
389
  }
390
390
  /**
391
391
  * Used for initializing the CastSender
package/cast-sender.js CHANGED
@@ -1,230 +1,2 @@
1
- var u = Object.defineProperty;
2
- var l = (n, i, e) => i in n ? u(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
- var s = (n, i, e) => l(n, typeof i != "symbol" ? i + "" : i, e);
4
- var h = (n, i, e) => new Promise((t, a) => {
5
- var o = (r) => {
6
- try {
7
- c(e.next(r));
8
- } catch (S) {
9
- a(S);
10
- }
11
- }, d = (r) => {
12
- try {
13
- c(e.throw(r));
14
- } catch (S) {
15
- a(S);
16
- }
17
- }, c = (r) => r.done ? t(r.value) : Promise.resolve(r.value).then(o, d);
18
- c((e = e.apply(n, i)).next());
19
- });
20
- import { E as g } from "./DGo74EDo.js";
21
- class p extends g {
22
- constructor(e) {
23
- super();
24
- s(this, "state", "not casting");
25
- s(this, "config");
26
- s(this, "unloaded", !1);
27
- /**
28
- * Update authentication token on an already established and authenticated connection
29
- */
30
- s(this, "updateAuthenticationToken", (e) => {
31
- this.config && (this.config.options.authenticationToken = e, this.send({
32
- type: "updateAuthToken",
33
- token: e
34
- }));
35
- });
36
- /**
37
- * Fully unloads the instance. This disconnects the current listener but lets the
38
- * cast session continue on the receiving device
39
- */
40
- s(this, "unload", () => {
41
- var e;
42
- this.unloaded = !0, (e = this.getSession()) == null || e.removeMessageListener("urn:x-cast:com.vindral.castdata", this.onMessage);
43
- });
44
- /**
45
- * Initiates the CastSender.
46
- * Will reject if Cast is not available on the device or the network.
47
- */
48
- s(this, "init", () => h(this, null, function* () {
49
- return new Promise((e, t) => {
50
- let a = !1;
51
- const o = setTimeout(() => {
52
- a = !0, t();
53
- }, 1e4);
54
- window.__onGCastApiAvailable = (d) => {
55
- if (a) {
56
- a = !1;
57
- return;
58
- }
59
- if (clearTimeout(o), !d)
60
- return t();
61
- setTimeout(() => {
62
- try {
63
- this.onGCastApiAvailable(), e();
64
- } catch (c) {
65
- t();
66
- }
67
- }, 1e3);
68
- }, this.castLibrariesAdded() && window.cast ? window.__onGCastApiAvailable(!0) : this.verifyCastLibraries();
69
- });
70
- }));
71
- /**
72
- * Requests a session. It will open the native cast receiver chooser dialog
73
- */
74
- s(this, "start", () => h(this, null, function* () {
75
- var e;
76
- yield (e = this.getInstance()) == null ? void 0 : e.requestSession();
77
- }));
78
- /**
79
- * Stops a session. It will stop playback on device as well.
80
- */
81
- s(this, "stop", () => {
82
- var e;
83
- (e = this.getSession()) == null || e.endSession(!0);
84
- });
85
- /**
86
- * Returns a string representing the name of the Cast receiver device or undefined if no receiver exists
87
- */
88
- s(this, "getReceiverName", () => {
89
- var e, t;
90
- return ((t = (e = this.getSession()) == null ? void 0 : e.getCastDevice()) == null ? void 0 : t.friendlyName) || void 0;
91
- });
92
- s(this, "onGCastApiAvailable", () => {
93
- var o;
94
- const e = this.getInstance();
95
- if (!e)
96
- throw "cast context should exist";
97
- const t = e.getSessionState(), a = ((o = this.config) == null ? void 0 : o.receiverApplicationId) || "A5452297";
98
- e.setOptions({
99
- receiverApplicationId: a,
100
- autoJoinPolicy: chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED,
101
- resumeSavedSession: !0
102
- }), e.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED, this.onSessionStateChanged), t === cast.framework.SessionState.SESSION_STARTED && setTimeout(() => {
103
- this.state = "casting", this.emit("resumed");
104
- });
105
- });
106
- s(this, "send", (e) => {
107
- var t;
108
- (t = this.getSession()) == null || t.sendMessage("urn:x-cast:com.vindral.castdata", e);
109
- });
110
- s(this, "onMessage", (e, t) => {
111
- if (e === "urn:x-cast:com.vindral.castdata")
112
- try {
113
- const a = JSON.parse(t);
114
- switch (a.type) {
115
- case "metadata":
116
- this.emit("metadata", a.metadata);
117
- break;
118
- case "serverWallclockTime":
119
- this.emit("server wallclock time", a.serverWallclockTime);
120
- break;
121
- default:
122
- break;
123
- }
124
- } catch (a) {
125
- }
126
- });
127
- s(this, "onSessionStarted", () => {
128
- var e;
129
- (e = this.getSession()) == null || e.addMessageListener("urn:x-cast:com.vindral.castdata", this.onMessage), this.send({
130
- type: "start",
131
- config: this.config
132
- });
133
- });
134
- s(this, "onSessionStateChanged", (e) => {
135
- if (!this.unloaded)
136
- switch (e.sessionState) {
137
- case cast.framework.SessionState.SESSION_START_FAILED:
138
- this.state = "not casting", this.emit("failed");
139
- break;
140
- case cast.framework.SessionState.SESSION_ENDED:
141
- this.state = "not casting", this.emit("disconnected");
142
- break;
143
- case cast.framework.SessionState.SESSION_ENDING:
144
- break;
145
- case cast.framework.SessionState.SESSION_RESUMED:
146
- this.onSessionStarted(), this.state = "casting", this.emit("resumed");
147
- break;
148
- case cast.framework.SessionState.SESSION_STARTED:
149
- this.onSessionStarted(), this.state = "casting", this.emit("connected");
150
- break;
151
- case cast.framework.SessionState.SESSION_STARTING:
152
- break;
153
- }
154
- });
155
- s(this, "getInstance", () => {
156
- var e;
157
- return (e = window.cast) == null ? void 0 : e.framework.CastContext.getInstance();
158
- });
159
- s(this, "getSession", () => {
160
- var e;
161
- return (e = this.getInstance()) == null ? void 0 : e.getCurrentSession();
162
- });
163
- // check if cast libraries are already added
164
- s(this, "castLibrariesAdded", () => !!(document.querySelector("#vindralCastFrameworkLib") && document.querySelector("#vindralCastSenderLib")));
165
- s(this, "verifyCastLibraries", () => {
166
- if (this.castLibrariesAdded())
167
- return;
168
- const e = document.createElement("script");
169
- 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);
170
- const t = document.createElement("script");
171
- t.type = "text/javascript", t.id = "vindralCastSenderLib", t.src = "//www.gstatic.com/cv/js/sender/v1/cast_sender.js", document.head.appendChild(t);
172
- });
173
- this.config = e;
174
- }
175
- /**
176
- * True if the instance is casting right now
177
- */
178
- get casting() {
179
- return this.state === "casting";
180
- }
181
- /**
182
- * The current volume
183
- */
184
- get volume() {
185
- var e, t;
186
- return (t = (e = this.getSession()) == null ? void 0 : e.getVolume()) != null ? t : 0;
187
- }
188
- /**
189
- * Set the current volume. Setting this to zero is equivalent to muting the video
190
- */
191
- set volume(e) {
192
- var t;
193
- (t = this.getSession()) == null || t.setVolume(e);
194
- }
195
- /**
196
- * The current language
197
- */
198
- get language() {
199
- var e, t;
200
- return (t = (e = this.config) == null ? void 0 : e.options) == null ? void 0 : t.language;
201
- }
202
- /**
203
- * Set the current language
204
- */
205
- set language(e) {
206
- this.config && (this.config.options.language = e, this.send({
207
- type: "setLanguage",
208
- language: e
209
- }));
210
- }
211
- /**
212
- * The current channelId
213
- */
214
- get channelId() {
215
- var e;
216
- return ((e = this.config) == null ? void 0 : e.options.channelId) || "";
217
- }
218
- /**
219
- * Set the current channelId
220
- */
221
- set channelId(e) {
222
- this.config && (this.config.options.channelId = e, this.send({
223
- type: "setChannelId",
224
- channelId: e
225
- }));
226
- }
227
- }
228
- export {
229
- p as CastSender
230
- };
1
+ import { t as e } from "./BdFcdkj1.js";
2
+ export { e as CastSender };
package/core.d.ts CHANGED
@@ -129,7 +129,7 @@ declare class UserAgentInformation {
129
129
  };
130
130
  }
131
131
  export type AudioCodec = "aac" | "opus" | "mp3";
132
- export type VideoCodec = "h264" | "av1";
132
+ export type VideoCodec = "h264" | "h265" | "av1";
133
133
  /**
134
134
  * The current reconnect state to use to decide whether to kep reconnecting or not
135
135
  */
@@ -481,8 +481,8 @@ interface TrackObject {
481
481
  displayWidth?: number;
482
482
  displayHeight?: number;
483
483
  language?: string;
484
- ["com.vindral.variant_uid"]?: string;
485
- ["com.vindral.drm"]?: string;
484
+ "com.vindral.variant_uid"?: string;
485
+ "com.vindral.drm"?: string;
486
486
  }
487
487
  interface CatalogRoot {
488
488
  version: number;
@@ -906,6 +906,7 @@ interface JitterModuleStatistics {
906
906
  interface MseModuleStatistics {
907
907
  quotaErrorCount: number;
908
908
  mediaSourceOpenTime: number;
909
+ playbackStallCount: number;
909
910
  totalVideoFrames?: number;
910
911
  droppedVideoFrames?: number;
911
912
  successfulVideoAppendCalls?: number;
@@ -1281,6 +1282,14 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1281
1282
  * setting targetBufferTime within that range for consistancy if using both min/max.
1282
1283
  */
1283
1284
  set targetBufferTime(bufferTimeMs: number);
1285
+ /**
1286
+ * Update the dynamic buffer time configuration at runtime.
1287
+ * Allows adjusting min and max buffer time without recreating the Vindral instance.
1288
+ */
1289
+ updateBufferTimeConfig(config: {
1290
+ minBufferTime?: number;
1291
+ maxBufferTime?: number;
1292
+ }): void;
1284
1293
  /**
1285
1294
  * The estimated playback latency based on target buffer time, the connection rtt and local playback drift
1286
1295
  */
@@ -1518,6 +1527,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1518
1527
  private suspend;
1519
1528
  private unsuspend;
1520
1529
  private getRuntimeInfo;
1530
+ private getPlaybackBufferState;
1531
+ private onMediaElementBufferState;
1521
1532
  private onMediaElementState;
1522
1533
  private onBufferEvent;
1523
1534
  /**
@@ -1635,7 +1646,7 @@ export interface PublicVindralEvents {
1635
1646
  * In case of a fatal error it is appropriate to indicate what the error was to the user, either by displaying the error.message or
1636
1647
  * by using the error.code() as a key to look up a localization string. To resume streaming it is required to create a new Vindral instance.
1637
1648
  */
1638
- ["error"]: Readonly<VindralError>;
1649
+ error: Readonly<VindralError>;
1639
1650
  /**
1640
1651
  * When the instance needs user input to activate audio or sometimes video playback.
1641
1652
  * Is called with an object
@@ -1646,51 +1657,51 @@ export interface PublicVindralEvents {
1646
1657
  * }
1647
1658
  * ```
1648
1659
  */
1649
- ["needs user input"]: NeedsUserInputContext;
1660
+ "needs user input": NeedsUserInputContext;
1650
1661
  /**
1651
1662
  * When a timed metadata event has been triggered
1652
1663
  */
1653
- ["metadata"]: Readonly<Metadata>;
1664
+ metadata: Readonly<Metadata>;
1654
1665
  /**
1655
1666
  * When the playback state changes
1656
1667
  */
1657
- ["playback state"]: Readonly<PlaybackState>;
1668
+ "playback state": Readonly<PlaybackState>;
1658
1669
  /**
1659
1670
  * When the connection state changes
1660
1671
  */
1661
- ["connection state"]: Readonly<ConnectionState>;
1672
+ "connection state": Readonly<ConnectionState>;
1662
1673
  /**
1663
1674
  * When the available rendition levels is changed
1664
1675
  */
1665
- ["rendition levels"]: ReadonlyArray<RenditionLevel>;
1676
+ "rendition levels": ReadonlyArray<RenditionLevel>;
1666
1677
  /**
1667
1678
  * When the rendition level is changed
1668
1679
  */
1669
- ["rendition level"]: Readonly<RenditionLevel>;
1680
+ "rendition level": Readonly<RenditionLevel>;
1670
1681
  /**
1671
1682
  * When the available languages is changed
1672
1683
  */
1673
- ["languages"]: ReadonlyArray<string>;
1684
+ languages: ReadonlyArray<string>;
1674
1685
  /**
1675
1686
  * When the available text tracks are changed
1676
1687
  */
1677
- ["text tracks"]: ReadonlyArray<string>;
1688
+ "text tracks": ReadonlyArray<string>;
1678
1689
  /**
1679
1690
  * When the available channels is changed
1680
1691
  */
1681
- ["channels"]: ReadonlyArray<Channel>;
1692
+ channels: ReadonlyArray<Channel>;
1682
1693
  /**
1683
1694
  * When a context switch state change has occured.
1684
1695
  * E.g. when a channel change has been requested, or quality is changed.
1685
1696
  */
1686
- ["context switch"]: Readonly<ContextSwitchState>;
1697
+ "context switch": Readonly<ContextSwitchState>;
1687
1698
  /**
1688
1699
  * Emitted when a wallclock time message has been received from the server.
1689
1700
  *
1690
1701
  * Note: This is the edge server wallclock time and thus may differ slightly
1691
1702
  * between two viewers if they are connected to different edge servers.
1692
1703
  */
1693
- ["server wallclock time"]: Readonly<number>;
1704
+ "server wallclock time": Readonly<number>;
1694
1705
  /**
1695
1706
  * Is emitted during connection whether the channel is live or not.
1696
1707
  *
@@ -1700,41 +1711,41 @@ export interface PublicVindralEvents {
1700
1711
  * Note: If the web-sdk is instantiated at the same time as you are starting the stream it is possible
1701
1712
  * that this emits false until the started state has propagated through the system.
1702
1713
  */
1703
- ["is live"]: boolean;
1714
+ "is live": boolean;
1704
1715
  /**
1705
1716
  * Emitted when a channel switch has been completed and the first frame of the new channel is rendered.
1706
1717
  * A string containing the channel id of the new channel is provided as an argument.
1707
1718
  */
1708
- ["channel switch"]: Readonly<ChannelSwitchContext>;
1719
+ "channel switch": Readonly<ChannelSwitchContext>;
1709
1720
  /**
1710
1721
  * Emmitted when a channel switch fails.
1711
1722
  * A string containing the channel id of the current channel is provided as an argument.
1712
1723
  */
1713
- ["channel switch failed"]: Readonly<ChannelSwitchContext>;
1724
+ "channel switch failed": Readonly<ChannelSwitchContext>;
1714
1725
  /**
1715
1726
  * Emitted when a language switch has been completed and the new language starts playing.
1716
1727
  */
1717
- ["language switch"]: Readonly<LanguageSwitchContext>;
1728
+ "language switch": Readonly<LanguageSwitchContext>;
1718
1729
  /**
1719
1730
  * Emitted when the volume state changes.
1720
1731
  *
1721
1732
  * This is triggered triggered both when the user changes the volume through the Vindral instance, but also
1722
1733
  * from external sources such as OS media shortcuts or other native UI outside of the browser.
1723
1734
  */
1724
- ["volume state"]: Readonly<VolumeState>;
1735
+ "volume state": Readonly<VolumeState>;
1725
1736
  /**
1726
1737
  * Emitted when the timeshift URLs are updated.
1727
1738
  */
1728
- ["timeshift info"]: Readonly<TimeShiftInfo>;
1739
+ "timeshift info": Readonly<TimeShiftInfo>;
1729
1740
  /**
1730
1741
  * Emitted for each CMAF fragment received via the MoQ/VoQ path.
1731
1742
  * Contains raw fMP4 bytes suitable for recording.
1732
1743
  *
1733
1744
  * @internal Not part of the public API — may change without notice.
1734
1745
  */
1735
- ["cmaf fragment"]: Readonly<CmafFragmentEvent>;
1736
- ["buffer state event"]: Readonly<BufferStateEvent>;
1737
- ["initialized media"]: void;
1746
+ "cmaf fragment": Readonly<CmafFragmentEvent>;
1747
+ "buffer state event": Readonly<BufferStateEvent>;
1748
+ "initialized media": void;
1738
1749
  }
1739
1750
 
1740
1751
  export {};
package/core.js CHANGED
@@ -1,13 +1,3 @@
1
- import { w as C, x as I, y as _, t as O, C as D, D as T, I as a, N as A, V as s, z as r } from "./DBHv5ggB.js";
2
- export {
3
- C as AUTHENTICATION_EXPIRED_CODE,
4
- I as AUTHENTICATION_FAILED_CODE,
5
- _ as CHANNEL_NOT_FOUND_CODE,
6
- O as CONNECTION_FAILED_AFTER_RETRIES_CODE,
7
- D as CONNECTION_FAILED_CODE,
8
- T as DISCONNECTED_BY_EDGE,
9
- a as INACTIVITY_CODE,
10
- A as NO_INCOMING_DATA,
11
- s as Vindral,
12
- r as VindralError
13
- };
1
+ import { t as e } from "./BGDidDHa.js";
2
+ import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, u as l } from "./C01DcfYu.js";
3
+ export { a as AUTHENTICATION_EXPIRED_CODE, s as AUTHENTICATION_FAILED_CODE, r as CHANNEL_NOT_FOUND_CODE, t as CONNECTION_FAILED_AFTER_RETRIES_CODE, o as CONNECTION_FAILED_CODE, c as DISCONNECTED_BY_EDGE, n as INACTIVITY_CODE, i as NO_INCOMING_DATA, e as Vindral, l as VindralError };