@tidal-music/player-web-components 0.2.1 → 0.2.2
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/active-device-changed-DKzZonX1--oMxdziu.js +7 -0
- package/dist/active-device-mode-changed-Dj16yzUX-BbRjSd-6.js +7 -0
- package/dist/audio-context-store-Ccv6WKna-C-yxIXdl.js +36 -0
- package/dist/basePlayer-CxowZx76-CfK9Qp4M.js +380 -0
- package/dist/browserPlayer-CJUIZMXc-Cwz_EqKS.js +170 -0
- package/dist/generate-guid-DMif1b6n-WXvDGKGF.js +1716 -0
- package/dist/index.js +363 -10
- package/dist/load-D2Tka_Qx-BNIMgt7e.js +29305 -0
- package/dist/media-element-error-circuit-breaker-fMDQ6k4B-B9oZKZUK.js +22 -0
- package/dist/nativePlayer-Bk8Y048r-S6bg9D6D.js +232 -0
- package/dist/output-devices-kF_iC6GM-CnAUEjc9.js +156 -0
- package/dist/pushkin-BJAKy5lP-BDJR20nC.js +117 -0
- package/dist/pushkin-CVLqA7Zj-DJu6_unL.js +2 -0
- package/dist/shakaPlayer-BvtoIIdC-CizBy6it.js +1448 -0
- package/dist/src/helpers.d.ts +18 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/tidal-current-time.d.ts +9 -0
- package/dist/src/tidal-duration-time.d.ts +9 -0
- package/dist/src/tidal-play-trigger.d.ts +2 -0
- package/dist/src/tidal-progress-bar.d.ts +2 -0
- package/dist/src/tidal-video-view.d.ts +2 -0
- package/dist/state-B888KJag-C7pa4Xs7.js +210 -0
- package/package.json +15 -13
- package/dist/_commonjsHelpers-DaMA6jEr-DtILRGNx.js +0 -8
- package/dist/basePlayer-Rqi9yRuo-4eKn-Akv.js +0 -528
- package/dist/browserPlayer-CXURpXdL-DjOb2ySS.js +0 -259
- package/dist/index-DHnVYeec.js +0 -3391
- package/dist/index.d.ts +0 -24
- package/dist/nativePlayer-b92CavhC-CABrQPGS.js +0 -323
- package/dist/output-devices-CUurcKto-C_F_9nLk.js +0 -224
- package/dist/shakaPlayer-D0NCOzx8-Dd1YFBoR.js +0 -24403
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const css: (template: {
|
|
2
|
+
raw: readonly string[] | ArrayLike<string>;
|
|
3
|
+
}, ...substitutions: any[]) => string;
|
|
4
|
+
export declare const html: (template: {
|
|
5
|
+
raw: readonly string[] | ArrayLike<string>;
|
|
6
|
+
}, ...substitutions: any[]) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Takes 't' seconds and formats them as '(hh:)mm:ss'.
|
|
9
|
+
* Only 0-pad minutes if needed (hours present).
|
|
10
|
+
*/
|
|
11
|
+
export declare function asTime(t?: number | string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Formats seconds to datetime durations for the <time> element.
|
|
14
|
+
*
|
|
15
|
+
* @see https://www.w3.org/TR/html5/infrastructure.html#duration-time-component
|
|
16
|
+
* @param {number} t - Seconds
|
|
17
|
+
*/
|
|
18
|
+
export declare function timeDateTime(t?: number | string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as TidalCurrentTime } from './tidal-current-time.js';
|
|
2
|
+
export { default as TidalDurationTime } from './tidal-duration-time.js';
|
|
3
|
+
export { default as TidalPlayButton } from './tidal-play-trigger.js';
|
|
4
|
+
export { default as TidalProgressBar } from './tidal-progress-bar.js';
|
|
5
|
+
export { default as TidalVideoView } from './tidal-video-view.js';
|
|
6
|
+
export type { CredentialsProvider } from '@tidal-music/common';
|
|
7
|
+
export { events, setCredentialsProvider, setEventSender, } from '@tidal-music/player';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const customElementName = "tidal-current-time";
|
|
2
|
+
export declare class TidalCurrentTime extends HTMLElement {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
renderTime(seconds: number): void;
|
|
8
|
+
}
|
|
9
|
+
export default customElementName;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const customElementName = "tidal-duration-time";
|
|
2
|
+
export declare class TidalDurationTime extends HTMLElement {
|
|
3
|
+
#private;
|
|
4
|
+
constructor();
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
renderTime(seconds: number): void;
|
|
8
|
+
}
|
|
9
|
+
export default customElementName;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
//#region ../player/dist/state-B888KJag.js
|
|
2
|
+
var e = Object.freeze({
|
|
3
|
+
apiUrl: "https://openapi.tidal.com/v2/",
|
|
4
|
+
audioAdaptiveBitrateStreaming: !0,
|
|
5
|
+
crossfadeInMs: 0,
|
|
6
|
+
desiredVolumeLevel: 1,
|
|
7
|
+
gatherEvents: !0,
|
|
8
|
+
legacyApiUrl: "https://api.tidal.com/v1",
|
|
9
|
+
loudnessNormalizationMode: "ALBUM",
|
|
10
|
+
outputDevicesEnabled: !1,
|
|
11
|
+
streamingWifiAudioQuality: "LOW"
|
|
12
|
+
});
|
|
13
|
+
function t(t) {
|
|
14
|
+
return e[t];
|
|
15
|
+
}
|
|
16
|
+
function n(t) {
|
|
17
|
+
return e = Object.freeze({
|
|
18
|
+
...e,
|
|
19
|
+
...t
|
|
20
|
+
}), Object.keys(t).forEach((e) => {
|
|
21
|
+
let n = e;
|
|
22
|
+
r.dispatchEvent(new CustomEvent(n, { detail: t[n] }));
|
|
23
|
+
}), e;
|
|
24
|
+
}
|
|
25
|
+
var r = new EventTarget();
|
|
26
|
+
function i(e) {
|
|
27
|
+
return new Promise((t) => setTimeout(() => t(), e));
|
|
28
|
+
}
|
|
29
|
+
function a(e, t) {
|
|
30
|
+
return new Promise((n) => {
|
|
31
|
+
e.addEventListener(t, (e) => n(e), !1);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
var o = class extends EventTarget {
|
|
35
|
+
#e;
|
|
36
|
+
set eventSender(e) {
|
|
37
|
+
this.#e = e;
|
|
38
|
+
}
|
|
39
|
+
get eventSender() {
|
|
40
|
+
return this.#e;
|
|
41
|
+
}
|
|
42
|
+
hasEventSender() {
|
|
43
|
+
return !!this.#e;
|
|
44
|
+
}
|
|
45
|
+
}, s = class extends EventTarget {
|
|
46
|
+
#e;
|
|
47
|
+
#t = 0;
|
|
48
|
+
set credentialsProvider(e) {
|
|
49
|
+
if (this.#e === e) return;
|
|
50
|
+
this.#e = e, this.#t += 1;
|
|
51
|
+
let t = this.#t;
|
|
52
|
+
this.dispatchAuthorized(t).catch(console.error), this.#e.bus((e) => {
|
|
53
|
+
if (t === this.#t) switch (e.detail.type) {
|
|
54
|
+
case "CredentialsUpdatedMessage":
|
|
55
|
+
this.dispatchAuthorized(t).catch(console.error);
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
console.warn("Unhandled event from credentials provider: ", e);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
get credentialsProvider() {
|
|
64
|
+
return this.#e;
|
|
65
|
+
}
|
|
66
|
+
async dispatchAuthorized(e) {
|
|
67
|
+
let t = await this.#e.getCredentials();
|
|
68
|
+
e !== void 0 && e !== this.#t || (t?.token ? this.dispatchEvent(new CustomEvent("authorized", { detail: { credentials: t } })) : this.dispatchEvent(new CustomEvent("unauthenticated", { detail: { credentials: t } })));
|
|
69
|
+
}
|
|
70
|
+
}, c = class extends Error {
|
|
71
|
+
errorCode = null;
|
|
72
|
+
errorId = null;
|
|
73
|
+
referenceId;
|
|
74
|
+
constructor(e, t, n) {
|
|
75
|
+
super(`${e}: ${t} (${n})`), this.errorId = e, this.errorCode = t, this.referenceId = n;
|
|
76
|
+
}
|
|
77
|
+
toJSON() {
|
|
78
|
+
return {
|
|
79
|
+
errorCode: this.errorCode,
|
|
80
|
+
errorId: this.errorId,
|
|
81
|
+
referenceId: this.referenceId
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
toString() {
|
|
85
|
+
return JSON.stringify(this.toJSON());
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
async function l() {
|
|
89
|
+
if (u.credentialsProvider) {
|
|
90
|
+
let e = await u.credentialsProvider.getCredentials();
|
|
91
|
+
return !!(e.token && e.userId);
|
|
92
|
+
}
|
|
93
|
+
return await a(u, "authorized"), l();
|
|
94
|
+
}
|
|
95
|
+
var u = new s(), d = new o();
|
|
96
|
+
async function f() {
|
|
97
|
+
let e = await l(), t = async () => {
|
|
98
|
+
let { Pushkin: e } = await import("./pushkin-CVLqA7Zj-DJu6_unL.js");
|
|
99
|
+
return e.refresh();
|
|
100
|
+
};
|
|
101
|
+
if (e) {
|
|
102
|
+
n({ gatherEvents: !0 });
|
|
103
|
+
try {
|
|
104
|
+
await Promise.all([t()]);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
console.error(e);
|
|
107
|
+
}
|
|
108
|
+
} else n({ gatherEvents: !1 });
|
|
109
|
+
}
|
|
110
|
+
function p() {
|
|
111
|
+
n({ gatherEvents: !0 });
|
|
112
|
+
}
|
|
113
|
+
u.addEventListener("authorized", () => {
|
|
114
|
+
f().then().catch(console.error);
|
|
115
|
+
}), u.addEventListener("unauthenticated", () => {
|
|
116
|
+
p();
|
|
117
|
+
});
|
|
118
|
+
async function m() {
|
|
119
|
+
return u.credentialsProvider ? (await u.credentialsProvider.getCredentials()).token ?? null : null;
|
|
120
|
+
}
|
|
121
|
+
var h = new class extends EventTarget {
|
|
122
|
+
dispatchError(e) {
|
|
123
|
+
this.dispatchEvent(new CustomEvent("error", { detail: e.toJSON() }));
|
|
124
|
+
}
|
|
125
|
+
}(), g = new class {
|
|
126
|
+
#e = /* @__PURE__ */ new Map();
|
|
127
|
+
#t = /* @__PURE__ */ new Map();
|
|
128
|
+
#n = /* @__PURE__ */ new Map();
|
|
129
|
+
#r = /* @__PURE__ */ new Map();
|
|
130
|
+
clone(e, t) {
|
|
131
|
+
let n = this.getMediaProductTransition(e), r = this.getStreamInfo(e), i = this.getPlaybackInfo(e);
|
|
132
|
+
if (!n || !r || !i) throw Error(`Cannot clone ${e}. Missing mediaProductTransition or streamInfo.`);
|
|
133
|
+
this.saveMediaProductTransition(t, {
|
|
134
|
+
...n,
|
|
135
|
+
playbackContext: {
|
|
136
|
+
...n.playbackContext,
|
|
137
|
+
playbackSessionId: t
|
|
138
|
+
}
|
|
139
|
+
}), this.saveStreamInfo(t, {
|
|
140
|
+
...r,
|
|
141
|
+
streamingSessionId: t
|
|
142
|
+
}), this.savePlaybackInfo(t, {
|
|
143
|
+
...i,
|
|
144
|
+
streamingSessionId: t
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
deleteMediaProductTransition(e) {
|
|
148
|
+
this.#e.delete(e);
|
|
149
|
+
}
|
|
150
|
+
deleteSession(e) {
|
|
151
|
+
this.deleteMediaProductTransition(e), this.#t.delete(e), this.#n.delete(e), this.deleteStreamInfo(e);
|
|
152
|
+
}
|
|
153
|
+
deleteStartedStreamInfo(e) {
|
|
154
|
+
this.#n.delete(e);
|
|
155
|
+
}
|
|
156
|
+
deleteStreamInfo(e) {
|
|
157
|
+
this.#r.delete(e);
|
|
158
|
+
}
|
|
159
|
+
getMediaProductTransition(e) {
|
|
160
|
+
return e ? this.#e.get(e) : void 0;
|
|
161
|
+
}
|
|
162
|
+
getPlaybackInfo(e) {
|
|
163
|
+
return e ? this.#t.get(e) : void 0;
|
|
164
|
+
}
|
|
165
|
+
getStreamInfo(e) {
|
|
166
|
+
return e ? this.#r.get(e) : void 0;
|
|
167
|
+
}
|
|
168
|
+
hasMediaProductTransition(e) {
|
|
169
|
+
return this.#e.has(e);
|
|
170
|
+
}
|
|
171
|
+
hasPlaybackInfo(e) {
|
|
172
|
+
return this.#t.has(e);
|
|
173
|
+
}
|
|
174
|
+
hasStartedStreamInfo(e) {
|
|
175
|
+
return this.#n.has(e);
|
|
176
|
+
}
|
|
177
|
+
hasStreamInfo(e) {
|
|
178
|
+
return this.#r.has(e);
|
|
179
|
+
}
|
|
180
|
+
overwriteDuration(e, t) {
|
|
181
|
+
let n = this.#e.get(e);
|
|
182
|
+
n && (n.playbackContext = {
|
|
183
|
+
...n.playbackContext,
|
|
184
|
+
actualDuration: t
|
|
185
|
+
}, this.saveMediaProductTransition(e, n));
|
|
186
|
+
}
|
|
187
|
+
saveMediaProductTransition(e, t) {
|
|
188
|
+
this.#e.set(e, t);
|
|
189
|
+
}
|
|
190
|
+
savePlaybackInfo(e, t) {
|
|
191
|
+
this.#t.set(e, t);
|
|
192
|
+
}
|
|
193
|
+
saveStreamInfo(e, t) {
|
|
194
|
+
this.#r.set(e, t);
|
|
195
|
+
}
|
|
196
|
+
setStartedStreamInfo(e) {
|
|
197
|
+
return this.#n.set(e, !0);
|
|
198
|
+
}
|
|
199
|
+
}(), _ = new class {
|
|
200
|
+
activePlayer;
|
|
201
|
+
preloadPlayer;
|
|
202
|
+
get preloadedMediaProduct() {
|
|
203
|
+
return g.getMediaProductTransition(this.preloadedStreamingSessionId)?.mediaProduct ?? void 0;
|
|
204
|
+
}
|
|
205
|
+
get preloadedStreamingSessionId() {
|
|
206
|
+
return this.preloadPlayer?.preloadedStreamingSessionId ?? void 0;
|
|
207
|
+
}
|
|
208
|
+
}();
|
|
209
|
+
//#endregion
|
|
210
|
+
export { h as a, m as c, u as d, g as i, r as l, c as n, i as o, d as r, l as s, _ as t, t as u };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidal-music/player-web-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
6
|
+
"types": "./dist/src/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"exports": {
|
|
16
|
+
"types": "./dist/src/index.d.ts",
|
|
16
17
|
"import": "./dist/index.js",
|
|
17
18
|
"default": "./dist/index.js"
|
|
18
19
|
},
|
|
@@ -21,16 +22,16 @@
|
|
|
21
22
|
"web-components"
|
|
22
23
|
],
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@vitest/coverage-v8": "
|
|
25
|
-
"@vitest/ui": "
|
|
26
|
-
"typescript": "
|
|
27
|
-
"vite": "
|
|
28
|
-
"vite-plugin-dts": "
|
|
29
|
-
"vitest": "
|
|
30
|
-
"@tidal-music/auth": "^1.
|
|
31
|
-
"@tidal-music/common": "^0.2.
|
|
32
|
-
"@tidal-music/
|
|
33
|
-
"@tidal-music/
|
|
25
|
+
"@vitest/coverage-v8": "4.1.5",
|
|
26
|
+
"@vitest/ui": "4.1.5",
|
|
27
|
+
"typescript": "6.0.3",
|
|
28
|
+
"vite": "8.0.12",
|
|
29
|
+
"vite-plugin-dts": "5.0.0",
|
|
30
|
+
"vitest": "4.1.5",
|
|
31
|
+
"@tidal-music/auth": "^1.6.1",
|
|
32
|
+
"@tidal-music/common": "^0.2.1",
|
|
33
|
+
"@tidal-music/player": "^0.18.1",
|
|
34
|
+
"@tidal-music/event-producer": "^2.4.1"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
37
|
"build": "vite build",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"test": "vitest",
|
|
45
46
|
"test:coverage": "pnpm run test --coverage",
|
|
46
47
|
"test:ui": "pnpm run test:coverage --ui",
|
|
47
|
-
"typecheck": "tsc"
|
|
48
|
+
"typecheck": "tsc",
|
|
49
|
+
"check:types-resolution": "attw --pack . --ignore-rules=cjs-resolves-to-esm"
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var l = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
-
function t(o) {
|
|
3
|
-
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
t as l,
|
|
7
|
-
l as o
|
|
8
|
-
};
|