@tidal-music/player-web-components 0.2.2 → 0.3.0

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.
@@ -1,4 +1,4 @@
1
- //#region ../player/dist/active-device-changed-DKzZonX1.js
1
+ //#region ../player/dist/active-device-changed-BDbOSq7P.js
2
2
  var e = "active-device-changed";
3
3
  function t(t) {
4
4
  return new CustomEvent(e, { detail: t });
@@ -1,4 +1,4 @@
1
- //#region ../player/dist/active-device-mode-changed-Dj16yzUX.js
1
+ //#region ../player/dist/active-device-mode-changed-OmLVES_4.js
2
2
  var e = "active-device-mode-changed";
3
3
  function t(t) {
4
4
  return new CustomEvent(e, { detail: t });
@@ -1,4 +1,4 @@
1
- //#region ../player/dist/audio-context-store-Ccv6WKna.js
1
+ //#region ../player/dist/audio-context-store-Bf50rcqa.js
2
2
  var e = (e, t, n) => {
3
3
  for (let r of e) {
4
4
  let e = r.addedNodes[0];
@@ -1,7 +1,7 @@
1
- import { a as e, i as t, l as n, o as r, t as i, u as a } from "./state-B888KJag-C7pa4Xs7.js";
2
- import { t as o } from "./pushkin-BJAKy5lP-BDJR20nC.js";
3
- import { a as s, c, d as l, f as u, l as d, n as f, o as p, p as m, t as h, u as g } from "./load-D2Tka_Qx-BNIMgt7e.js";
4
- //#region ../player/dist/basePlayer-CxowZx76.js
1
+ import { a as e, i as t, l as n, o as r, t as i, u as a } from "./state-BT7sE_jc-iVaBwnBC.js";
2
+ import { t as o } from "./pushkin-C7W2HCqN-BHqS8oLX.js";
3
+ import { a as s, c, d as l, f as u, i as d, l as f, o as p, s as m, t as h, u as g } from "./load-L6Urw8gV-CQAMBwcN.js";
4
+ //#region ../player/dist/basePlayer-D9LFxFnB.js
5
5
  function _(e, t) {
6
6
  return new CustomEvent("media-product-transition", { detail: {
7
7
  mediaProduct: e,
@@ -149,15 +149,15 @@ var O = class {
149
149
  }
150
150
  eventTrackingStreamingEnded(e, { endAssetPosition: t, endReason: n }) {
151
151
  let r = o.now();
152
- d([h({
152
+ u([d({
153
153
  endAssetPosition: t,
154
154
  endTimestamp: r,
155
155
  streamingSessionId: e
156
- })]).catch(console.error), p([f({
156
+ })]).catch(console.error), l([s({
157
157
  endReason: D(n),
158
158
  endTimestamp: r,
159
159
  streamingSessionId: e
160
- }), l({
160
+ }), g({
161
161
  streamingSessionId: e,
162
162
  timestamp: r
163
163
  })]).catch(console.error);
@@ -173,7 +173,7 @@ var O = class {
173
173
  start: "streaming_metrics:playback_statistics:idealStartTimestamp"
174
174
  });
175
175
  try {
176
- f({
176
+ s({
177
177
  actualStartTimestamp: o.timestamp("streaming_metrics:playback_statistics:actualStartTimestamp", e),
178
178
  idealStartTimestamp: o.timestamp("streaming_metrics:playback_statistics:idealStartTimestamp", e),
179
179
  outputDevice: this.#i,
@@ -190,15 +190,15 @@ var O = class {
190
190
  return;
191
191
  }
192
192
  let { mediaProduct: r, playbackContext: i } = n, a = o.now();
193
- h({
193
+ d({
194
194
  actualAssetPresentation: i.actualAssetPresentation,
195
195
  actualAudioMode: "actualAudioMode" in i ? i.actualAudioMode : null,
196
196
  actualProductId: i.actualProductId,
197
197
  actualQuality: i.actualAudioQuality || i.actualVideoQuality,
198
198
  extras: r.extras,
199
- isPostPaywall: s(i.actualAssetPresentation, r),
199
+ isPostPaywall: p(i.actualAssetPresentation, r),
200
200
  playbackSessionId: e,
201
- productType: m(r.productType),
201
+ productType: f(r.productType),
202
202
  requestedProductId: r.productId,
203
203
  sourceId: r.sourceId,
204
204
  sourceType: r.sourceType,
@@ -225,7 +225,7 @@ var O = class {
225
225
  return 0;
226
226
  }
227
227
  async hardReload(e, t) {
228
- return this.currentStreamingSessionId && this.finishCurrentMediaProduct("skip"), g(e, t);
228
+ return this.currentStreamingSessionId && this.finishCurrentMediaProduct("skip"), m(e, t);
229
229
  }
230
230
  hasNextItem() {
231
231
  return this.preloadedStreamingSessionId;
@@ -253,7 +253,7 @@ var O = class {
253
253
  if (this.preloadedStreamingSessionId) return t.getMediaProductTransition(this.preloadedStreamingSessionId);
254
254
  }
255
255
  set outputDeviceType(e) {
256
- this.#i = e ? u(e) : void 0;
256
+ this.#i = e ? c(e) : void 0;
257
257
  }
258
258
  overwriteMediaProduct(e, n) {
259
259
  let r = t.getMediaProductTransition(e);
@@ -285,7 +285,7 @@ var O = class {
285
285
  case r("IDLE", "STALLED"): return;
286
286
  case r("PLAYING", "NOT_PLAYING"):
287
287
  case r("PLAYING", "IDLE"):
288
- this.duration && this.currentTime < this.duration && c(this.currentStreamingSessionId, {
288
+ this.duration && this.currentTime < this.duration && h(this.currentStreamingSessionId, {
289
289
  actionType: "PLAYBACK_STOP",
290
290
  assetPosition: this.currentTime,
291
291
  timestamp: o.now()
@@ -293,7 +293,7 @@ var O = class {
293
293
  break;
294
294
  case r("IDLE", "PLAYING"):
295
295
  case r("NOT_PLAYING", "PLAYING"):
296
- this.currentTime !== this.startAssetPosition && c(this.currentStreamingSessionId, {
296
+ this.currentTime !== this.startAssetPosition && h(this.currentStreamingSessionId, {
297
297
  actionType: "PLAYBACK_START",
298
298
  assetPosition: this.currentTime,
299
299
  timestamp: o.now()
@@ -324,7 +324,7 @@ var O = class {
324
324
  seekEnd(t) {
325
325
  let n = this.currentStreamingSessionId;
326
326
  if (n) {
327
- let r = () => c(n, {
327
+ let r = () => h(n, {
328
328
  actionType: "PLAYBACK_START",
329
329
  assetPosition: t,
330
330
  timestamp: o.now()
@@ -339,7 +339,7 @@ var O = class {
339
339
  }
340
340
  }
341
341
  seekStart(e) {
342
- this.currentStreamingSessionId && c(this.currentStreamingSessionId, {
342
+ this.currentStreamingSessionId && h(this.currentStreamingSessionId, {
343
343
  actionType: "PLAYBACK_STOP",
344
344
  assetPosition: e,
345
345
  timestamp: o.now()
@@ -1,8 +1,8 @@
1
- import { a as e, i as t, o as n, u as r } from "./state-B888KJag-C7pa4Xs7.js";
2
- import { a as i, n as a } from "./audio-context-store-Ccv6WKna-C-yxIXdl.js";
3
- import { n as o, r as s, t as c } from "./basePlayer-CxowZx76-CfK9Qp4M.js";
4
- import { t as l } from "./media-element-error-circuit-breaker-fMDQ6k4B-B9oZKZUK.js";
5
- //#region ../player/dist/browserPlayer-CJUIZMXc.js
1
+ import { a as e, i as t, o as n, u as r } from "./state-BT7sE_jc-iVaBwnBC.js";
2
+ import { a as i, n as a } from "./audio-context-store-Bf50rcqa-DUuCXOzU.js";
3
+ import { n as o, r as s, t as c } from "./basePlayer-D9LFxFnB-BNIKxMHD.js";
4
+ import { t as l } from "./media-element-error-circuit-breaker-BUJbK6sd-DNlFckiw.js";
5
+ //#region ../player/dist/browserPlayer-BzBNrx-C.js
6
6
  var u = class extends c {
7
7
  #e;
8
8
  #t;
@@ -1,4 +1,4 @@
1
- //#region ../player/dist/generate-guid-DMif1b6n.js
1
+ //#region ../player/dist/generate-guid-BMGZjV-R.js
2
2
  var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
3
3
  if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
4
4
  get: ((e) => i[e]).bind(null, d),
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as e, d as t, i as n, r, t as i } from "./state-B888KJag-C7pa4Xs7.js";
2
- import { t as a } from "./pushkin-BJAKy5lP-BDJR20nC.js";
3
- import { r as o, t as s } from "./audio-context-store-Ccv6WKna-C-yxIXdl.js";
4
- import { u as c } from "./load-D2Tka_Qx-BNIMgt7e.js";
1
+ import { a as e, d as t, i as n, r, t as i } from "./state-BT7sE_jc-iVaBwnBC.js";
2
+ import { t as a } from "./pushkin-C7W2HCqN-BHqS8oLX.js";
3
+ import { r as o, t as s } from "./audio-context-store-Bf50rcqa-DUuCXOzU.js";
4
+ import { s as c } from "./load-L6Urw8gV-CQAMBwcN.js";
5
5
  //#region ../player/dist/index.js
6
6
  function l() {
7
7
  return i.activePlayer?.getPosition() ?? 0;
@@ -162,14 +162,18 @@ var O = "tidal-play-trigger", k = class extends HTMLElement {
162
162
  }, this.#i();
163
163
  }
164
164
  static get observedAttributes() {
165
- return ["product-id", "product-type"];
165
+ return [
166
+ "product-id",
167
+ "product-type",
168
+ "share-code"
169
+ ];
166
170
  }
167
171
  async #n() {
168
172
  await this.#r(), f() === "PLAYING" ? p() : await m();
169
173
  }
170
174
  #r() {
171
- let e = u()?.productId ?? void 0;
172
- if (this.mediaProduct && this.mediaProduct.productId !== e) return c(this.mediaProduct, 0);
175
+ let e = u(), t = this.mediaProduct;
176
+ if (t && (e?.productId !== t.productId || e?.productType !== t.productType || e?.shareCode !== t.shareCode)) return c(t, 0);
173
177
  }
174
178
  #i() {
175
179
  this.#t || this.addEventListener("click", this.#e, { passive: !0 });
@@ -195,6 +199,7 @@ var O = "tidal-play-trigger", k = class extends HTMLElement {
195
199
  if (e) return {
196
200
  productId: e,
197
201
  productType: this.getAttribute("product-type") === "video" ? "video" : "track",
202
+ shareCode: this.getAttribute("share-code")?.trim() || void 0,
198
203
  sourceId: "",
199
204
  sourceType: ""
200
205
  };