@tidal-music/player-web-components 0.1.0 → 0.1.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/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { e as i, f as s, m as r, p as d, q as t, y as l, X as o } from "./index-tM9JvbA8.js";
1
+ import { j as i, k as s, n as r, o as d, q as o, b as t, K as l } from "./index-DbGwqQeZ.js";
2
2
  export {
3
3
  i as TidalCurrentTime,
4
4
  s as TidalDurationTime,
5
5
  r as TidalPlayButton,
6
6
  d as TidalProgressBar,
7
- t as TidalVideoView,
8
- l as events,
9
- o as setCredentialsProvider
7
+ o as TidalVideoView,
8
+ t as events,
9
+ l as setCredentialsProvider
10
10
  };
@@ -1,5 +1,5 @@
1
- import { b as m, y as s, H as u, n as k, P as p, k as o, l as g, s as P, t as S, i as b } from "./index-tM9JvbA8.js";
2
- import { Y as f, V as y, O as L } from "./basePlayer-a-avZASH-Ux-6s9Ex.js";
1
+ import { S as m, b as s, $ as u, s as f, g as p, T as o, l as g, e as P, X as S, r as b } from "./index-DbGwqQeZ.js";
2
+ import { G as k, V as y, Y as L } from "./basePlayer-BcooVl9P-WesO1_17.js";
3
3
  const E = "active-device-disconnected";
4
4
  function w() {
5
5
  return new CustomEvent(E);
@@ -17,7 +17,7 @@ const D = {
17
17
  deviceunknownerror: "NPD00"
18
18
  };
19
19
  let i;
20
- class A extends f {
20
+ class A extends k {
21
21
  #s = "default";
22
22
  /**
23
23
  * A Boolean which is true if the media contained in the element has finished playing.
@@ -36,7 +36,7 @@ class A extends f {
36
36
  name = "nativePlayer";
37
37
  playbackEngineHandlerAttached = !1;
38
38
  constructor() {
39
- super(), m("outputDevicesEnabled") && (async () => (i = (await import("./output-devices-NXuo75MQ-_vYYuqUm.js")).outputDevices, this.#e.listDevices()))(), this.#e = // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
+ super(), m("outputDevicesEnabled") && (async () => (i = (await import("./output-devices-BhcWYG6e-l4DCXneM.js")).outputDevices, this.#e.listDevices()))(), this.#e = // eslint-disable-next-line @typescript-eslint/ban-ts-comment
40
40
  // @ts-ignore
41
41
  window.NativePlayerComponent.Player(), this.playbackState = "IDLE", this.registerEventListeners(), this.#e.setVolume(100);
42
42
  }
@@ -49,7 +49,7 @@ class A extends f {
49
49
  #d(e) {
50
50
  this.debugLog("handleMediaError", e.target);
51
51
  const t = e.target, a = D[t.errorCode];
52
- this.currentStreamingSessionId && k({
52
+ this.currentStreamingSessionId && f({
53
53
  errorCode: a,
54
54
  errorMessage: JSON.stringify(e.target),
55
55
  streamingSessionId: this.currentStreamingSessionId
@@ -261,10 +261,10 @@ class A extends f {
261
261
  }
262
262
  // eslint-disable-next-line @typescript-eslint/require-await
263
263
  async reset({ keepPreload: e } = { keepPreload: !1 }) {
264
- this.#r || (this.debugLog("reset"), e || await this.unloadPreloadedMediaProduct(), this.#e.stop(), this.playbackState !== "IDLE" && this.hasStarted() && this.finishCurrentMediaProduct("skip"), this.detachPlaybackEngineEndedHandler(), this.currentStreamingSessionId = void 0, e || (this.preloadedStreamingSessionId = void 0), this.playbackState = "IDLE", this.#r = !0);
264
+ this.#r || (this.debugLog("reset"), e || await this.unloadPreloadedMediaProduct(), this.#e.stop(), this.playbackState !== "IDLE" && this.finishCurrentMediaProduct("skip"), this.detachPlaybackEngineEndedHandler(), this.currentStreamingSessionId = void 0, e || (this.preloadedStreamingSessionId = void 0), this.playbackState = "IDLE", this.#r = !0);
265
265
  }
266
266
  async seek(e) {
267
- this.hasStarted() || await this.mediaStateChange("active"), this.seekStart(), this.currentTime = e, this.#e.seek(e), this.seekEnd();
267
+ this.hasStarted() || await this.mediaStateChange("active"), this.seekStart(this.currentTime), this.currentTime = e, this.#e.seek(e), this.seekEnd(this.currentTime);
268
268
  }
269
269
  // Handles track "skip next" and progressions between shaka and native player
270
270
  async skipToPreloadedMediaProduct() {
@@ -1,6 +1,6 @@
1
- import { h as V, y as S, l as b, g as T } from "./index-tM9JvbA8.js";
2
- import { l as W } from "./_commonjsHelpers-f3sTPFkQ-YKQV-mq1.js";
3
- var q = function() {
1
+ import { i as V, b as S, l as y, m as T } from "./index-DbGwqQeZ.js";
2
+ import { l as W } from "./_commonjsHelpers-DaMA6jEr-DtILRGNx.js";
3
+ var q = /* @__PURE__ */ function() {
4
4
  function s(e, t, n, i, a) {
5
5
  return e < t || n < t ? e > n ? n + 1 : e + 1 : i === a ? t : t + 1;
6
6
  }
@@ -17,12 +17,12 @@ var q = function() {
17
17
  c++;
18
18
  if (i -= c, a -= c, i === 0 || a < 3)
19
19
  return a;
20
- var o = 0, r, d, h, l, f, v, m, p, D, C, E, A, u = [];
20
+ var o = 0, r, d, l, h, f, v, m, p, D, C, E, A, u = [];
21
21
  for (r = 0; r < i; r++)
22
22
  u.push(r + 1), u.push(e.charCodeAt(c + r));
23
23
  for (var P = u.length - 1; o < a - 3; )
24
- for (D = t.charCodeAt(c + (d = o)), C = t.charCodeAt(c + (h = o + 1)), E = t.charCodeAt(c + (l = o + 2)), A = t.charCodeAt(c + (f = o + 3)), v = o += 4, r = 0; r < P; r += 2)
25
- m = u[r], p = u[r + 1], d = s(m, d, h, D, p), h = s(d, h, l, C, p), l = s(h, l, f, E, p), v = s(l, f, v, A, p), u[r] = v, f = l, l = h, h = d, d = m;
24
+ for (D = t.charCodeAt(c + (d = o)), C = t.charCodeAt(c + (l = o + 1)), E = t.charCodeAt(c + (h = o + 2)), A = t.charCodeAt(c + (f = o + 3)), v = o += 4, r = 0; r < P; r += 2)
25
+ m = u[r], p = u[r + 1], d = s(m, d, l, D, p), l = s(d, l, h, C, p), h = s(l, h, f, E, p), v = s(h, f, v, A, p), u[r] = v, f = h, h = l, l = d, d = m;
26
26
  for (; o < a; )
27
27
  for (D = t.charCodeAt(c + (d = o)), v = ++o, r = 0; r < P; r += 2)
28
28
  m = u[r], u[r] = v = s(m, d, v, D, u[r + 1]), d = m;
@@ -55,7 +55,7 @@ class w {
55
55
  this.name = t, this.id = n === "default" && a === "default" ? "default" : T(), this.nativeDeviceId = n, this.webDeviceId = a, this.type = i, this.controllableVolume = e !== !1;
56
56
  }
57
57
  }
58
- function y(s) {
58
+ function b(s) {
59
59
  if (B(s))
60
60
  return "windowsCommunication";
61
61
  if ("id" in s && s.id === "BuiltInSpeakerDevice")
@@ -85,7 +85,7 @@ function y(s) {
85
85
  function I(s, e) {
86
86
  const t = e.toLowerCase();
87
87
  let n = s;
88
- return t.includes("mac") && (n = s.split("(")[0].trim()), n;
88
+ return t.includes("mac") && (n = (s.split("(")[0] ?? "").trim()), n;
89
89
  }
90
90
  function B(s) {
91
91
  let e;
@@ -160,20 +160,20 @@ class N {
160
160
  e.nativeDeviceId = void 0, e.webDeviceId = void 0;
161
161
  }), this.#t.forEach((e) => {
162
162
  const t = L(this.outputDevices, e.name);
163
- t ? (t.nativeDeviceId = e.id, t.controllableVolume = e.controllableVolume, t.type = y(e) || t.type) : this.outputDevices.add(
163
+ t ? (t.nativeDeviceId = e.id, t.controllableVolume = e.controllableVolume, t.type = b(e) || t.type) : this.outputDevices.add(
164
164
  new w({
165
165
  controllableVolume: e.controllableVolume,
166
166
  name: I(e.name, g.os.name || ""),
167
167
  nativeDeviceId: e.id,
168
- type: y(e)
168
+ type: b(e)
169
169
  })
170
170
  );
171
171
  }), this.#r.forEach((e) => {
172
172
  const t = L(this.outputDevices, e.label);
173
- t ? (t.webDeviceId = e.deviceId, t.type = y(e) || t.type) : this.outputDevices.add(
173
+ t ? (t.webDeviceId = e.deviceId, t.type = b(e) || t.type) : this.outputDevices.add(
174
174
  new w({
175
175
  name: I(e.label, g.os.name || ""),
176
- type: y(e),
176
+ type: b(e),
177
177
  webDeviceId: e.deviceId
178
178
  })
179
179
  );
@@ -198,7 +198,7 @@ class N {
198
198
  await Promise.any([e, t, n(1e3)]), this.mergeDevices(), this.emitDeviceChange();
199
199
  }
200
200
  set activeDevice(e) {
201
- this.#i = e, this.#a = !1, this.#n = "shared", b.activePlayer?.updateOutputDevice()?.catch(console.error);
201
+ this.#i = e, this.#a = !1, this.#n = "shared", y.activePlayer?.updateOutputDevice()?.catch(console.error);
202
202
  }
203
203
  get activeDevice() {
204
204
  return this.#i;
@@ -207,7 +207,7 @@ class N {
207
207
  * Set the current device mode for the output device.
208
208
  */
209
209
  set deviceMode(e) {
210
- const { activeDevice: t } = this, { activePlayer: n } = b;
210
+ const { activeDevice: t } = this, { activePlayer: n } = y;
211
211
  t && n && n.name === "nativePlayer" && this.deviceMode !== e && (this.#n = e, n.updateDeviceMode());
212
212
  }
213
213
  get deviceMode() {
@@ -217,7 +217,7 @@ class N {
217
217
  * Set to true to disable software MQA decoder.
218
218
  */
219
219
  set passThrough(e) {
220
- const { activeDevice: t } = this, { activePlayer: n } = b;
220
+ const { activeDevice: t } = this, { activePlayer: n } = y;
221
221
  t && n && n.name === "nativePlayer" && this.passThrough !== e && (this.#a = e, n.updatePassThrough());
222
222
  }
223
223
  get passThrough() {
@@ -228,7 +228,7 @@ const $ = new N();
228
228
  export {
229
229
  w as OutputDevice,
230
230
  N as OutputDevices,
231
- y as findOutputType,
231
+ b as findOutputType,
232
232
  L as getOutputDeviceByName,
233
233
  B as isWindowsCommunicationsDevice,
234
234
  I as marshalLabel,